Welcome to Geeklog, Anonymous Tuesday, November 26 2024 @ 06:24 pm EST

Geeklog Forums

Adding profile variables confusion

Page navigation


Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
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
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The plugin_profile functions are the older ones, dating back to the days when "My Account" used to be 2 or 3 (can't remember) separate pages. It's quite possible that the functionality of those API functions was lost during the changes that happened since then.

I should have a plugin here somewhere that I wrote for a customer back in the day that used these functions. Need to dig it out and see if it still works, but that may take a few days as I'm quite busy right now ...

bye, Dirk
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
If you could that would be great.

I think we definitely need an easy way for plugins to add options to the user account editor without the need for hand-editing templates.


Looks like Blaine's messenger plugin also has some of this functionality which seems to partially work on one of my older gl1.4.x sites <- yes I still have a 1.4 site Oops!

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
Any further thoughts on this Dirk?

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
So gone is the opportunity to let plugins add options to the user account editor in GL1.6

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
I'm sure Dirk is just busy at the moment.

You should report this issue as a bug and hopefully it will be fixed for 1.6.1

Tom
One of the Geeklog Core Developers.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
FWIW, I found the plugin in question, but the code is a little older than I thought - it uses $HTTP_GET_VARS and the like and needs some cleaning up before I can even try it out.

bye, Dirk
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
Dirk, any chance to get a look at this?

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
I think Dirk is on vacation, so we may not hear from him untill the first week of November.
One of the Geeklog Core Developers.
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
bump <and some extra words to make the limit>
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
Where in the forum is it being used?

If you want you can send me your updated newsletter plugin and I can step through it to see what I can make of it. Maybe 2 sets of eyes can figure it out or at least figure out what changes need to be done in Geeklog to make it work.

Tom
One of the Geeklog Core Developers.
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
This has nothing to do with the forum.

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
I realize that it has nothing to do with the forum, in a previous post you did mention that the forum did attempt to add a profile field "The only examples of any of these functions I could find were in the forum.... which don't work either."

I was just going to take a look at that for an example.

Tom
One of the Geeklog Core Developers.
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
The example I found was in forum 2.7 functions.inc
function plugin_profileextrassave_forum
function plugin_profilevariablesedit_forum
function plugin_profilevariablesdisplay_forum
these only seem to partially work as I stated earlier I can create a link in the user's account settings but not within the tabs and a link at the bottom of the page is useless.

I may just bail on this as support for geeklog is waning.
shame as I just made a jQuery live chat and chatterblock replacement plugin.

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
Quote by: suprsidr

The example I found was in forum 2.7 functions.inc
function plugin_profileextrassave_forum
function plugin_profilevariablesedit_forum
function plugin_profilevariablesdisplay_forum
these only seem to partially work as I stated earlier I can create a link in the user's account settings but not within the tabs and a link at the bottom of the page is useless.

I may just bail on this as support for geeklog is waning.
shame as I just made a jQuery live chat and chatterblock replacement plugin.

-s



I hope you don't bail, we need peoples contributions.

I just spent the last 2 hours going over the code for the forum in regards to these functions. After doing a bit of testing it looks like (for at least the forum anyways) all that is missing are the template variables in the preference template files. Of course editing these files is not ideal, just to include a plugins template variables needed for editing and/or displaying some plugins user preferences. What really should be happening here is the ability for a plugin to add a new tab and specify the template file to use for that tab. This would not be too difficult to do.

I probably am missing something here but you should join the Geeklog mailing list and post this request. Blaine is on there and maybe he can shed some light here.

I just took a look at my rating plugin and enabled user ratings which display in the my account area. You have to add the rating tag to the profile.html file. Once you have done this the function

function plugin_profilevariablesdisplay_rating ($uid, &$template)

will then display the users rating and allow a user to rate another user. It only shows up in the preview tab which is not ideal since my account defaults to the Username & Password tab. The best solution would be the ability for a plugin to add their own tab.

Tom

One of the Geeklog Core Developers.
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
The best solution would be the ability for a plugin to add their own tab.

I don't necessarily agree there. A plugin should be able to add to any tab, save maybe preview and username/password.
The ability for a plugin to create a tab would be great, but most would only need a line or two in an existing tab.

Mark added an API to glfusion for just such a purpose.

I gave up, and just added subscribe/unsubscribe to the usermenu. Not optimal, but hey 4 months is long enough to wait for an answer.

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
You are right if the information relates to the tab then it should go there. But it would be nice for a pluging to be able to add a new tab on the fly.

Since I am currently working on the rating plugin I tested a few more things out this morning and I got it to work. The code is just a sample but it does work. Basically for your plugin you need to add the appropriate tag to the correct template file, in my case it is rating. Once this is done you can use the function plugin_profilevariablesdisplay_rating to display information on the preview page of My Account and the User page. plugin_profilevariablesedit_rating then is used to add your html and fields to any of the tabs. For example if you wanted to add information to the privacy tab, add your template tag to the preferences/privacyblock.html, this way it appears within the form. plugin_profileextrassave_rating is then used to save the information by $_REQUEST your input fields.

I hope this helps.

plugin_profilevariablesdisplay_rating displays

Text Formatted Code

// Used to Save any information from the My account page for the plugin.
function plugin_profileextrassave_rating ()
{
        global $_RATING_CONF;
       
    echo "ha" . $_REQUEST['score'];
}

// Used to display information for edit on the My Account page. Tag can be placed in one of the template files under the preferences directory.
function plugin_profilevariablesedit_rating ($uid, &$template)
{
        global $_RATING_CONF;
       
        if ($_RATING_CONF['user'] == 1) {
                $template->set_var( 'rating',  '<input type="Text" id="score" name="score"></input>');
        }
}

// Used to display rating information for the users page and the preview page under my account.
// rating tag needs to be added to users\profile.html template file
function plugin_profilevariablesdisplay_rating ($uid, &$template)
{
        global $_RATING_CONF;
       
        if ($_RATING_CONF['user'] == 1) {
                $template->set_var( 'rating',  RATING_generateDisplay('user', $uid));
        }
}
 

One of the Geeklog Core Developers.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Okay, so after unsuccessfully trying to get the wrong plugin working :banghead: I finally found the plugin I had in mind and got it to install. Unfortunately, I get the same effect as described in the initial post: The additional block is rendered outside of the actual form, even when you disable JavaScript (which forces all the tabs to be displayed in one long form).

So, it looks like at least the API relating to adding blocks is broken - and probably has been for a long time.

Not sure where to go from here. Anyone want to suggest a new API that adds tabs? The old one should probably just be deprecated and left by the wayside ...

bye, Dirk
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
I prefer jQuery UI Tabs easy to mix with php and the ajax functionality of jQuery is stupid simple.

:twocents:

-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Status: offline

beewee

Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
I´m using the Jquery tools from Flowplayer: http://flowplayer.org/tools/ and http://flowplayer.org/tools/using.html#api, you can see the tabs in action on this site running GL: http://www.caravans.nl/
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
 Quote

Page navigation

All times are EST. The time is now 06:24 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content