Firefox PHP

Real Name Module (5.1 and 5.2 ready)

Re: Real Name Module (5.1 and 5.2 ready)
December 01, 2006 03:16AM
Hi Maurice,

Quote
mmakaay
On my own site, I use this to not only show another name, but also to point the profile link to my own profile system, [...] and add an icon if the user is in my chatroom.

That's what I meant with "embedded". ;-)

Regards
Oliver


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Re: Real Name Module (5.1 and 5.2 ready)
December 08, 2006 06:07AM
hi
i'm trying to get this to work with the Last Forum Post module...[www.phorum.org]

i've added the following to rewrite_rules.src:

# ----------------------------------------------------------------------
# Support for the last_post module
# ----------------------------------------------------------------------

page read

  array [MOD_LAST_FORUM_POST]
    rewrite author with real_name(user_id)
    rewrite link_author with profile_url(user_id)
  end array

end page


but no joy. can anyone help? thanks!!!
Re: Real Name Module (5.1 and 5.2 ready)
December 08, 2006 06:23AM
You configured here that $PHORUM["MOD_LAST_FORUM_POST"] is an array. Each record in that array would contain a field named "author" and a field named "link_author". These would be rewritten to the real name and profile URL using the id that can be found in the field "user_id". All this has to be done on pages which have the "phorum_page" set to "read" (so basically this has to be done on the read page).

This is wrong, since the mod you're referring to seems to modify the forum description on the index page and it does not fill $PHORUM["MOD_LAST_FORUM_POST"] at all. I guess you're just trying to copy some rewrite rules that were written for another mod, without knowing the semantics.

The real_name module does all its rewriting stuff after all processing has been done and before the data is sent to the browser. This means that it lets Phorum fill all the template fields and then overrides the fields that need changing. At every place where a user's name is put in a single template variable (e.g. $PHORUM["DATA"]["AUTHOR"] c.q. {AUTHOR}), this mod can be told to change the data in that field using the rewrite rules.

The Last Forum Post mod does change the description field of the forums by adding last post info and as such, the name of the author(s) is not separated in a template variable. Instead, all author names are put together inside a block of text with other text surrounding it. Therefore you cannot possibly write real_name rewrite rules for rewriting these names.

Conclusion: Because of it's structure, the Last Forum Post mod needs to be hacked in order to provide the names that you want on screen.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Real Name Module (5.1 and 5.2 ready)
December 08, 2006 06:32AM
hi maurice

thanks for the reply, although half of it is greek to me. i am flailing about in the dark with trying to make adjustments to phorum. it's quite hard to get definitive information about how to reference variables among other things.

guess i'll try the last forum post thread and see if anyone responds there to a plea for help in hacking it to show the real name.

thanks!
Re: Real Name Module (5.1 and 5.2 ready)
December 08, 2006 04:20PM
Hacking the code should not be that hard. Use the phorum_user_get() function to retrieve the full user data and after that print out the real name in the user data instead of the author field from the posting. This probably isn't enough for you to fly on, but at least you'll have the steps to perform in the last post module to get the results you want. I'll see how far you got after I get back from my vacation ;-) Good luck!


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Real Name Module (5.1 and 5.2 ready)
December 11, 2006 06:49AM
thanks for your reply but you're right that isn't enough for me to fly on. is there any documentation for this function? can anyone provide some sample code?
thanks!
Re: Real Name Module (5.1 and 5.2 ready)
January 03, 2007 07:34AM
If you look at the real_name.php script from the real_name version 2 mod, then you can find some example code. Here's a snippet (from line 174). The $user_id variable should contain the id of the user that posted the message.
        $user = phorum_user_get($user_id, false);

        // Determine the displayname to show.
        if (!$user) {
            // We have a user id in the posting, but the user does no longer
            // exist within forum. Use "anonmous user" for the display name.
            $displayname = $GLOBALS["PHORUM"]["DATA"]["LANG"]["AnonymousUser"];
        } else {
            if (isset($user["real_name"]) && trim($user["real_name"]) != '') {
                $displayname = $user["real_name"];
            } else {
                $displayname = $user["username"];
            }
        }

        // Determine the profile page URL.
        if ($user) {
            $link_url = phorum_get_url(PHORUM_PROFILE_URL, $user_id);
        }

After this code, you can use $displayname and $link_url to create the real name + link. Something like this:
    print '<a href="' . htmlspecialchars($link_url) . '">';
    print htmlspecialchars($displayname);
    print '</a>';


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Real Name Module (5.1 and 5.2 ready)
January 04, 2007 04:20AM
hi maurice

thanks much for the reply. everytime i add something to lastforumpost.php i get mysql syntax errors. i guess my php skills are not really up to snuff for this mod. anyway, thanks for yr help.
Re: Real Name Module (5.1 and 5.2 ready)
January 16, 2007 06:41PM
Hi,
I downloaded the current phorum version and installed it - the BBCode module doesn't show an option to turn off its quote function. Strangely enough, even in the realnames module the quote function was set to off, but nevertheless, the sanity check showed that there were two modules using it, namely BBCode and realnames.
ciao

Grendel
Re: Real Name Module (5.1 and 5.2 ready)
January 17, 2007 03:25AM
Hi Grendel,

Quote
Grendel
I downloaded the current phorum version and installed it

It seems you downloaded my module 1.3.0

Quote
Grendel
the BBCode module doesn't show an option to turn off its quote function

There are varios BBCode modules. The basic one shows an option "Enable quote hook" (last option in the module settings).

Quote
Grendel
Strangely enough, even in the realnames module the quote function was set to off

Default value is off.

Quote
Grendel
but nevertheless, the sanity check showed that there were two modules using it, namely BBCode and realnames.

The sanity check can only check how many modules are registered for using the quote hook. It doesn't say that theses modules are really using the hook...

Regards
Oliver


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Sorry, only registered users may post in this forum.

Click here to login