It's unclear which function to use to add variables to the profile editor(gl1.6).
I've tried both:
Text Formatted Code
function plugin_profileblocksedit_newsletter($uid)
{
global $LANG_NL, $_USER;
list($whitelist) = NL_fetchWhitelist();
$checked = (in_array($_USER['email'], $whitelist))?'checked="checked"':'';
return '<input type="checkbox" name="user_edit_newsletter_checkbox" '.$checked.'/>'
. '<label for="user_edit_newsletter_checkbox">'. $LANG_NL['user_edit_checkbox_label'] .'</label>';
}
function plugin_profilevariablesedit_newsletter($uid, &$template)
{
global $LANG_NL, $_USER;
list($whitelist) = NL_fetchWhitelist();
$checked = (in_array($_USER['email'], $whitelist))?'checked="checked"':'';
$template->set_file('newsletter_check',newsletter_templatePath('profile.thtml'));
$template->set_var ('newsletter_checkbox', '<input type="checkbox" name="user_edit_newsletter_checkbox" '.$checked.'/>'
. '<label for="user_edit_newsletter_checkbox">'. $LANG_NL['user_edit_checkbox_label'] .'</label>');
$template->parse ('output', 'newsletter_check', true);
}
The first does indeed add my "Newsletter Subscription" checkbox to the editor, but it's rendered outside of the form, so its value never gets passed along with $_POST
The second does nothing at all.
AND
We have two functions to react to the changes:
plugin_profileextrassave_newsletter
and:
plugin_user_changed_newsletter
Which is preferred?
plugin_user_changed_newsletter seems to get called twice for some reason.
Currently neither works as my variables are not being passed with $_POST as mentioned above.
http://wiki.geeklog.net/index.php/Profile_Functions <-
needs expanding
as does http://wiki.geeklog.net/index.php/Plugin_API
The only examples of any of these functions I could find were in the forum.... which don't work either.
-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 -
http://www.flashyourweb.com