Firefox PHP

Subscribers Mod - reward users, sell subscriptions etc

Posted by sheik 
Re: Subscribers Mod - reward users, sell subscriptions etc
November 06, 2006 08:50PM
Hi Sheik,

First let me says that Velum seem to have succeded in making module avialable to certain group only. I will let him post th emodule when ready.

For my question about stting, I solve the problem. Simply deactivating the add banners was not enough for me. What I wanted to do is offer different templates (color and look) to subscriber.

So I added the condition about subscriber in the cc_usersetting.php file and added some extra variable in the setting.php file. So when a subcriber is actif, he gets a different template that when he is not.

Regards,

yves
Re: Subscribers Mod - reward users, sell subscriptions etc
July 14, 2007 11:20PM
I've installed this Module and I'm trying to use it as a 'Founding Member' flag or sorts. If the member is subscribed.. they are a 'Founding Member' of the community. Then when it see's they are a 'subscribed' member it shows the 'Founding Member' text. Simple enough.. it works in the users profile pages well.

However, I'm trying to get it to also display below the users name within the users messages, just like the User Rank module does. I've tried to get it to display but, I just haven't figured out how. Can you advise me on how to do this or what code to use?
Re: Subscribers Mod - reward users, sell subscriptions etc
July 28, 2009 12:29PM
This module works with Phorum 5.2.12a by the way, I will upload a revised package once a slight conflict is resolved.

(continued from another thread, @ Maurice)

Quote
/\dam
I can only assume my module knackers the $user array at a critical point somehow.
Quote
Maurice
Does is knacker the $user array or did you forget to return $user; at the end of the hook? That is the most common error that I can think of.

Thanks Maurice, my module function doesn't accept an argument, and doesn't return anything. I wasn't aware it should return anything! :-) It kind of works in a similar fashion to Brian's Announcements mod, in that the main functions don't accept arguments, they then mess about with a few Phorum global data structures and then exit without returning anything.
Specifically, my module uses the common hook, checks a Phorum custom profile field, and based on that value changes the value of another custom profile field (in memory, no data is saved using the API).
i.e. it pretty much just does something like this:

Language: PHP
global $PHORUM; $PHORUM["user"]["mycustomfield"] = true;

However, this does seem to break your Google Map module, if I add it to the cc_save_user hook, so clearly I've done something that should be frowned on :-)

Or, maybe the problem was that I added my module to both the common and cc_save_user hooks at the same time?

Either way, it's not critical, as the module doesn't need to be run on cc_save_user anyway.

/\dam

--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
Re: Subscribers Mod - reward users, sell subscriptions etc
July 28, 2009 12:42PM
there is no problem with working with multiple hooks for a module.
but the function for cc_save_user gets an argument and needs to return that one. see the docs.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Subscribers Mod - reward users, sell subscriptions etc
July 28, 2009 12:47PM
Here's what the hook implementation should look like:

Language: PHP
function phorum_mod_foo_cc_save_user ($data) { // .... // Fiddle with your global vars here. // ....   // Return the $data that was passed as the argument. // Phorum';s hook code will take this returned data and // feed it to the next cc_save_user hook function. // If you do not return the data, then Phorum will feed // NULL to the next hook in line. return $data; }


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Subscribers Mod - reward users, sell subscriptions etc
July 28, 2009 05:07PM
@ Thomas, that makes sense, thank you.

@ Maurice, do I still need to do the "return $data" if I'm only using the common hook?

Thanks to both of you,

/\dam

--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
Re: Subscribers Mod - reward users, sell subscriptions etc
July 28, 2009 06:18PM
each hook has different definitions. maurice's example was for the cc_save_user hook. I think the common hook has no input/output but please check the docs :).


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Subscribers Mod - reward users, sell subscriptions etc
July 28, 2009 06:30PM
Understood, I have now bookmarked the relevant docs. :-) (there are a lot more hooks now than when I last checked!)

Thanks again,

/\dam

--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
Re: Subscribers Mod - reward users, sell subscriptions etc
July 28, 2009 08:15PM
See documentation -> developer -> docs for hook "common"
It tells that it gets no input and returns no input.
So for "common" it's okay to use

Language: PHP
function phorum_mod_foo_common() { // Do your stuff, without returning any data. }


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Subscribers Mod - reward users, sell subscriptions etc
July 28, 2009 08:16PM
Yes, thanks, that's why I wrote "understood" ;-)

/\dam

--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
Sorry, only registered users may post in this forum.

Click here to login