How to bypass forum user public profile?
Posted: 07 February 2009 08:24 AM   [ Ignore ]
Member
Avatar
RankRankRank
Total Posts:  345
Joined  2009-01-23

Is this even possible?

I have the “users” template but how i can bypass ee-forums public profile page? There is “ziljon” links to it everywhere so i tried to embed this template to forum template, with no success. Neither i did something wrong or there is no solution? Hope there is, i dont want that i have User Module but no-go with Forums with User module…

Thanks:
- Tuittu

 Signature 

Fan of Solspace’s software!

Profile
 
 
Posted: 07 February 2009 09:39 PM   [ Ignore ]   [ # 1 ]
Member
RankRankRank
Total Posts:  117
Joined  2007-07-19

I had to hack the forum module to redirect links to the right places… You have to re-apply the changed on every forum update.  If might be possible to also do this if you run the forum through the EE templating system by manually editing the links…

It might also be possible to do an extension that does this (which would be very handy), but i’m not sure if the correct hooks exist.

Here is a quick guide for hacking the forums:

At line 977 of mod.forum.php is a good place to create different paths.  You’ll probably want to change the current profile path.  You can create several path varialbes here (you might want login and register to be in a different template group than the member profiles etc), but for simplicity i’ve just edited _profile_path so it remaps all the default profile stuff to “www.example.com/user/id/”

function _profile_path($id)
       
{
        
global $FNS;
        return 
$FNS->create_url('user/').$id.'/';
       

If you plan to use private messaging though, you will need to make a few more changes so that runs through the default member templates

Then at line 1222 you can see a list of all the auto generated links the forum uses, if you keep your front end templates setup the same way as the default EE member templates then i dont think you need to worry about this…

It’s was very time consuming to get the forums to play how i wanted…

Profile
 
 
Posted: 09 February 2009 08:56 AM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  8281
Joined  2006-10-18

Thanks Joobs smile

 Signature 
Profile
 
 
Posted: 20 June 2009 07:29 PM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  9
Joined  2007-04-06

@ Joobs - or anyone else out there….

I realize that this might be a dead post but i’m hoping someone will see it and be able to help.  The mod to the forum module listed above works great… however, the path I have to my users profiles (using the solspace user module) ends with the username *not the member ID.  Would anyone be able to show me what this would look like displaying the username in the URL as opposed to a member ID?

Profile
 
 
Posted: 20 June 2009 09:20 PM   [ Ignore ]   [ # 4 ]
Member
RankRankRank
Total Posts:  117
Joined  2007-07-19

Hmmm, changing stuff in the forum is very painful, and my php and query skills are pretty basic.  Off the top of my head the easiest way might be to use a query to find the username of the ID that’s being sent to the profile path function.

function _profile_path($id)
       
{
    
global $DB$FNS;
    
$query $DB->query("SELECT username FROM exp_members WHERE member_id = '$id'");
    return 
$FNS->create_url('user/').$query.'/';
       

Just out of curiosity, have you done anything special to stop members from having any non url safe characters in their usernames?

Profile
 
 
Posted: 21 June 2009 10:30 AM   [ Ignore ]   [ # 5 ]
Newbie
Rank
Total Posts:  9
Joined  2007-04-06

Thanks for the quick reply Joobs.. unfortunately I get the following error when trying what you suggested:

Catchable fatal error: Object of class DB_Cache could not be converted to string in /var/www/vhosts/example.com/httpdocs/system/modules/forum/mod.forum.php on line 985

It seems to have an issue with this line:

return $FNS->create_url('members/profile/').$query.'/'

In particular the .$query. bit.  Any other thoughts?

Profile
 
 
Posted: 21 June 2009 11:26 AM   [ Ignore ]   [ # 6 ]
Member
RankRankRank
Total Posts:  117
Joined  2007-07-19

well, i’m not sure, the above was just a guess.

I assume my query is wrong, or it’s returning something that EE isn’t liking.  You might want to post this into the “howto” part of the EE forums.

Profile
 
 
Posted: 22 June 2009 12:43 PM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  8281
Joined  2006-10-18

I did this once a long time ago… my method was to search through the template code for all instances of “[forums]/members” and change it to my own path, whatever it be smile

 Signature 
Profile
 
 
Posted: 22 January 2010 02:01 PM   [ Ignore ]   [ # 8 ]
Newbie
Avatar
Rank
Total Posts:  8
Joined  2010-01-12

I’m doing this right now. The member path that is currently in mod.forum.php is:

function _profile_path($id)
       
{
        
return $this->_fetch_pref('member_profile_path').$id.'/';
       

I didn’t see [forums]/members int his file. Is member_profile_path the same thing?

My profiles page links to: http://mywebsite.net/index.php/apfriendsmain/profile/

So I will try /index.php/apfriendsmain/profile/

Unfortunately when I navigate to that page I get the following error: http://grab.by/1Upn

Any suggestions?? smile

 Signature 

http://www.wearepapertiger.com

Profile
 
 
Posted: 22 January 2010 04:55 PM   [ Ignore ]   [ # 9 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  8281
Joined  2006-10-18

You’ll get that error if there’s no Member ID in the URI. Some Forum links will take you to different pages, based on what they are. If it’s a “View your own profile”, it will probably leave out your Member ID from the URI, but if it’s another member, it’ll likely work. smile

 Signature 
Profile
 
 
Posted: 23 January 2010 01:07 PM   [ Ignore ]   [ # 10 ]
Newbie
Avatar
Rank
Total Posts:  8
Joined  2010-01-12

Got it working! I changed the following:

if ($this->use_site_profile == TRUE)
        
{
            $this
->preferences['member_profile_path'$FNS->create_url($PREFS->ini('profile_trigger').'/');
        

to

if ($this->use_site_profile == TRUE)
        
{
            $this
->preferences['member_profile_path'$FNS->create_url($PREFS->ini('profile_trigger').'/../../../friends/profile/');
        

And all of the profiles on the Forum link to the profiles in the Friends module I installed. Sweet!

 Signature 

http://www.wearepapertiger.com

Profile