2 questions - is email required , disabling login and new profile links.

Posted by KWood 
Re: 2 questions - is email required , disabling login and new profile links.
November 12, 2008 04:47AM
Talking with Thomas in the chat has cleared up something. You are setting some global settings in the get_user hook, which should have been user settings. So instead of changing $PHORUM, change the data for the $user instead. Those fields are part of the user data and not part of the global $PHORUM data.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: 2 questions - is email required , disabling login and new profile links.
November 12, 2008 11:56AM
Yes just that.
And I have change to using the common hook, but as far as I can se those 2 changes dos not work... my code is this (I am building a combined module for integrated login and invalid email "support):

[code="php"]
function phorum_mod_disableemailfunctions_user_get() {

$PHORUM = $GLOBALS["PHORUM"];

IF (! $PHORUM['mod_disableemailfunctions']['no_email'] || !$PHORUM['mod_disableemailfunctions']['so_userid']) {return;};


// print $GLOBALS["PHORUM"]['user']['email'].";<BR>";
IF ($PHORUM['user']['email'] !=str_replace($PHORUM['mod_disableemailfunctions']['no_email'], 'X', $PHORUM['user']['email'])) {

// the following seems to be working:
$GLOBALS["PHORUM"]['user']['email_notify']=0;
$GLOBALS["PHORUM"]['user']['pm_email_notify']=0;
$GLOBALS["PHORUM"]['user']['moderation_email']=0;
$GLOBALS["PHORUM"]['user']['hide_email']=1;
$GLOBALS["PHORUM"]['user']['pm_email_notify']=0;
//general settings I am not sure if they work
$GLOBALS["PHORUM"]["pm_email_notify"]=FALSE;
$GLOBALS["PHORUM"]["allow_email_notify"]=FALSE;

return;
}
return;
}
[/code]


----
can u see why the 2 last may not work?
Are there any other points that should be changed?

Now there "only" thing i need tho do is disable half of the controlpanel:-).... hmmmm



Edited 1 time(s). Last edit at 11/12/2008 01:34PM by Maurice Makaay.
Re: 2 questions - is email required , disabling login and new profile links.
November 12, 2008 01:29PM
Hi
I am using the cc_save_user hook to prevent the user from altering certain fields...
but changing email still workshalfway meaning that it creates and sends a cofirming mail to the new email adress, I am going to remove the email link from to template files (when i get to locate it) and have lock the display settings, but would like disable updating email al together...

As for the notify settings i have fixed it so that i change the saving values so that users with wrong e-mail can't save settings different from what I allow, but can i for those users write a extra text on the controlpanel telling the user that this field has no effekt or simply disabling the field in the form directly ???
Re: 2 questions - is email required , disabling login and new profile links.
November 12, 2008 01:38PM
as a last question: can i make the changes to the form from my module? or do i have to make the changes to the template directly, and if so can i in the template test what the users email is ??
Re: 2 questions - is email required , disabling login and new profile links.
November 12, 2008 01:40PM
It looks like you named your function ...user_get, but that it is called from common_post_user or so. Am I correct? The function name is somewhat confusing in that respect.

I guess your problem is that:
	$GLOBALS["PHORUM"]["pm_email_notify"]=FALSE;E;

needs to be

	$GLOBALS["PHORUM"]["allow_pm_email_notify"]=FALSE;E;


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: 2 questions - is email required , disabling login and new profile links.
November 12, 2008 01:43PM
You should set a template variable from your module that flags the template that the user is one without a valid email. You should try to keep your templates for output only and keep the logic in the module code.

Likewise, you cannot change templating code from the module logic. Only a few things can be tweaked from module code and those are nomally things like you are doing now by setting global options to different values. But that is basically the mechanism that I described above. The templates already have {IF} statements for checking those features.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: 2 questions - is email required , disabling login and new profile links.
November 12, 2008 02:24PM
Hi
sorry if I'm a bit slow :-) but does that mean that in the template there already is a if statement that check if that field has to be disabled and all I have to do is to set/unset that variable? And if so how do i find the right variable?
Re: 2 questions - is email required , disabling login and new profile links.
November 12, 2008 02:37PM
and, the $GLOBALS["PHORUM"]["allow_pm_email_notify"]=FALSE; worked super (removed the PM email field) but i dont seem to be able to get the "$GLOBALS["PHORUM"]["email_notify"]=FALSE;" to do anything....

as a note I changed the functions name so t makes more sence :-)

and thanks for all the your help!!!!
Re: 2 questions - is email required , disabling login and new profile links.
November 12, 2008 05:06PM
$GLOBALS["PHORUM"]["email_notify"]=FALSE
does not set any existing settings variable. You need:
$GLOBALS["PHORUM"]["allow_email_notify"]=FALSE

Quote

sorry if I'm a bit slow :-) but does that mean that in the template there already is a if statement that check if that field has to be disabled and all I have to do is to set/unset that variable? And if so how do i find the right variable?

You can see in the template whether there is such option or not. Just check if the bit of HTML that is outputted in the page is surrounded by some {IF ....} ... {/IF} statement. If it is, then you might be able to tweak the data in $PHORUM['DATA'] to change the condition result for the IF statement. So, if you have allow_pm_notify = FALSE, then the PM information is automatically not shown in the Phorum interface, because of such construction.

For all core Phorum features, there is a representation in the templates. If you are doing things that are not part of the Phorum core, then you can be pretty sure that there is no template support for disabling them from your module code. So for those you need to hack te templates.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: 2 questions - is email required , disabling login and new profile links.
November 13, 2008 01:02AM
Hi
when setting $GLOBALS["PHORUM"]["allow_email_notify"]=FALSE nothing seems to change in the controlpanel, what should that do ?
Sorry, only registered users may post in this forum.

Click here to login