Posted on: 07/08/09 09:16pm
By: suprsidr
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
Re: Adding profile variables confusion
Posted on: 07/09/09 03:51am
By: Dirk
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
Re: Adding profile variables confusion
Posted on: 07/09/09 07:02am
By: suprsidr
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
-s
Re: Adding profile variables confusion
Posted on: 07/16/09 05:14pm
By: suprsidr
Any further thoughts on this Dirk?
-s
Re: Adding profile variables confusion
Posted on: 07/20/09 02:19pm
By: suprsidr
So gone is the opportunity to let plugins add options to the user account editor in GL1.6
-s
Re: Adding profile variables confusion
Posted on: 07/21/09 03:44pm
By: Laugh
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
Re: Adding profile variables confusion
Posted on: 07/21/09 04:50pm
By: Dirk
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
Re: Adding profile variables confusion
Posted on: 10/21/09 07:59pm
By: suprsidr
Dirk, any chance to get a look at this?
-s
Re: Adding profile variables confusion
Posted on: 10/22/09 09:38am
By: Laugh
I think Dirk is on vacation, so we may not hear from him untill the first week of November.
Re: Adding profile variables confusion
Posted on: 11/04/09 07:58am
By: suprsidr
bump <and some extra words to make the limit>
Re: Adding profile variables confusion
Posted on: 11/04/09 08:46am
By: Laugh
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
Re: Adding profile variables confusion
Posted on: 11/04/09 04:17pm
By: suprsidr
This has nothing to do with the forum.
-s
Re: Adding profile variables confusion
Posted on: 11/04/09 04:53pm
By: Laugh
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
Re: Adding profile variables confusion
Posted on: 11/04/09 05:09pm
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
Re: Adding profile variables confusion
Posted on: 11/04/09 11:09pm
By: Laugh
Quote by: suprsidrThe 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
Re: Adding profile variables confusion
Posted on: 11/04/09 11:28pm
By: suprsidr
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[*1] subscribe/unsubscribe to the usermenu. Not optimal, but hey 4 months is long enough to wait for an answer.
-s
Re: Adding profile variables confusion
Posted on: 11/05/09 09:43am
By: Laugh
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));
}
}
Re: Adding profile variables confusion
Posted on: 11/08/09 03:41pm
By: Dirk
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
Re: Adding profile variables confusion
Posted on: 11/08/09 05:51pm
By: suprsidr
I prefer
jQuery UI Tabs[*2] easy to mix with php and the ajax functionality of jQuery is stupid simple.
:twocents:
-s
Re: Adding profile variables confusion
Posted on: 11/09/09 03:18am
By: beewee
Re: Adding profile variables confusion
Posted on: 11/09/09 03:24pm
By: Blaine
Good luck getting Dirk to allow more then the most basic javascript into core. I've been trying to add a more enhanced UI and use of javascript libraries for years. The farthest I ever got was the Advanced Editor mode.
If Geeklog has to work with Javascript disabled then we need an API that can be extended so sites can enable a more sophisticated UI that uses popular and well accepted JS frameworks like JQuery, YUI or mootools.
For now, I've decided to modify core and extend using my own techniques.
Re: Adding profile variables confusion
Posted on: 11/09/09 07:57pm
By: Laugh
The last time the javascript library topic was talked about on the mailing list was back in February.
I think it is time to make a decision on this, but the problem is no one is completely familiar with of all the popular javascript libraries so we never got a complete list of advantages of each library.
A couple of plugins already use Mootools and I know that is what Joomla uses. WordPress uses SACK. I am sure the CMS developers had their reasons for choosing these libraries, probably many of the same reasons we are considering.
A few others liked YUI, which Blaine wrote a good post about on the mailing list (Are you still using YUI and JQuery Blaine?)
Here is the best chart I have found so far for comparing the libraries.
http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks
I just really want a choice to be made so I don't go down to far using MooTools and then we decide to use something else, and then I have to recode everything :wink:
Edit: One other thing I did check Google Analytics and it looks like about 91% of surfers have javascript enabled.
Re: Adding profile variables confusion
Posted on: 11/09/09 08:55pm
By: suprsidr
HOoooo, Holdon one here....
There should be no discussion on which js library should be the de-facto Geeklog js library.
That should be up to the theme designer.
Hey, if geeklog wants to distribute the professional theme utilizing mootools or YUI who cares.
What I want is the ability to choose my theme's(or any theme I design's) javascript library without worrying about conflicting functionability.
Save fckeditor.
This should definately be a theme developer's choice.
--s
Re: Adding profile variables confusion
Posted on: 11/09/09 09:35pm
By: Blaine
I have used YUI, JQuery, Mootools and a number of other libraries and have had good experience with them all. They normally also work well together and compatibility is getting better. Shortly we (Nextide) will be releasing new plugins and one uses YUI and JQuery extensively.
JQuery is an excellent library and it's contributed plugins and community has been growing dramatically. It's very flexible, powerful and more focused on UI and site layout enhancements.
YUI also is an excellent library for developers but there is a very small number of contributed plugins. YUI is a larger library that covers more functionality with excellent documentation and community support.
There is more to picking a JS library then just what site themer's would like. Multiple libraries could be enabled if required and with caching, compression and dynamic loading, the extra payload may not be a noticed. If we want to improve the user interface and site admin to use AJAX, then you need to pick one library or it will certainly complicate and add to the work effort. That may not be an issue, if we had 1000 developers like Drupal but that is not the case.
Re: Adding profile variables confusion
Posted on: 11/10/09 06:34am
By: Dirk
Quote by: BlaineIf we want to improve the user interface and site admin to use AJAX, then you need to pick one library or it will certainly complicate and add to the work effort.
I agree. There are some issues in our bugtracker that can only be solved or implemented using JavaScript. So we could either continue to roll our own JS code (like with the tabs interface for My Account) or adopt an existing JS library. And from my point of view, it would make more sense not to reinvent the wheel, especially given the size of the community, as Blaine already pointed out.
(I was going to write more on the general topic of JavaScript but I think I'll rather post that on geeklog-devel later today)
bye, Dirk
Re: Adding profile variables confusion
Posted on: 11/10/09 11:41am
By: Laugh
Quote by: suprsidrHOoooo, Holdon one here....
There should be no discussion on which js library should be the de-facto Geeklog js library.
That should be up to the theme designer.
--s
Geeklog does need to pick one for a standard so we can start implementing features for the admin, AJAX enhancements, theme enhancements, etc..., but I also think if a plugin author or theme designer doesn't like the choice made that they can tell Geeklog to load in whatever library they want.