• Welcome to Simple Machines Community Forum. Please login or sign up.
October 24, 2021, 05:06:36 AM

News:

Want to get involved in developing SMF, then why not lend a hand on our github!


Add a new link into the mini profile

Started by wynnyelle, April 14, 2013, 09:33:29 PM

Previous topic - Next topic

wynnyelle

I want to add a link into everyone's mini profile that leads to their blog, if they have one {if not it would just lead to the blog page in general or something}. The blogs are an add-on, but they all contain the same type of link since it's just one per profile. Looks like this:

Quote
http://warriorcatsrpg.com/index.php?action=pmxblog;sa=view;uid=299

With the 299 being whatever the person's profile ID number is {that's just my own number for example}. I would think this is doable fairly easily as a link, but I am not sure so I thought I would post here.

For people with no blog, it should redirect to the main blogs page, right now it appears to create a non functional blog page when sent to the blog page of someone who does not have a blog. Their profile shows up as the owner of a non-active blog, but below it is a blog creation page that doesn't function. I just want it to redirect to the main listing page.

If that's too off-topic for this, don't worry, I just want to create the mini profile link and then I'll work from there.

hcfwesker

April 14, 2013, 10:54:28 PM #1 Last Edit: April 14, 2013, 11:05:08 PM by hcfwesker
The redirect for a member with no blog is out of the question for me ( havent seen this MOD in action at all).  But try this for linking to member blogs from mini-profile

Just add wherever you want in Display.template.php

                          // Member Blog Links ...
echo '
<li>View ', $message['member']['username'], '\'s <a href="', $scripturl, '?action=pmxblog;sa=view;uid=', $message['member']['id'], '"/>Blog</a></li>';


You can reword it however you want. this should mnake it appear as ::

View Groovystar's Blog

wynnyelle

OMG thank you! I'll try it in the ultimate profile too since I want to add these blog links there, too. I'll post back here letting you know how it goes.

Haven't heard from you in a while hope you are doing well.

hcfwesker

April 14, 2013, 11:07:39 PM #3 Last Edit: April 14, 2013, 11:18:44 PM by hcfwesker
Been doin good :)  it has been awhile lol

for Ultimate Profile, needs a little change.  both places that has $message, change them both to $context

                          // Member Blog Links ...
echo '
<li>View ', $context['member']['name'], '\'s <a href="', $scripturl, '?action=pmxblog;sa=view;uid=', $context['member']['id'], '"/>Blog</a></li>';

wynnyelle

Unfotunately this code did not work properly, but it did wind up displaying the member's true username, which is a large no-no. Only the display name should ever show, as the true username is something that a member may or may not allow others to see.

wynnyelle

I just tried it in another place and it is doing the same thing I can't use this.

Also the word Blog never shows up, so there is no link.

Arantor

Use $context['member']['name'] instead of $context['member']['username']
No good deed goes unpunished
All helpful urges should be circumvented

hcfwesker

April 14, 2013, 11:13:52 PM #7 Last Edit: April 14, 2013, 11:37:44 PM by hcfwesker
                          // Member Blog Links ...
echo '
<li>View ', $message['member']['name'], '\'s <a href="', $scripturl, '?action=pmxblog;sa=view;uid=', $message['member']['id'], '"/>Blog</a></li>';



EDIT:  yeah, like Arantor said lol

hcfwesker

Quote from: Groovystar on April 14, 2013, 11:09:56 PM
I just tried it in another place and it is doing the same thing I can't use this.

And this is honestly why I usually avoid your topics cause you crack and break down at the first sign of it not going exactly as you planned lol.  Some codes take a little trial and error ... especially when it's something custom, some people NEEEEEEEEEEED to try and be patient and allow the person trying to help to work around the issue before breaking down.  Yikes!

The code works, I promise you, as I just tested it myself. 

wynnyelle

I didn't break down. I was just saying I couldn't use it. I'm on my testing site anyway so nobody is suffering for it. I'm sorry if it looked like I was.

I will try again. Oh and thank you too Arantor!

wynnyelle

Okay. I tried it again. The problem is that the word Blog {the link area} is still not showing up.

Should the whole thing be before or after the other "Echo"'s in the coding?

hcfwesker

use thie updated code from earlier

                          // Member Blog Links ...
echo '
<li>View ', $message['member']['name'], '\'s <a href="', $scripturl, '?action=pmxblog;sa=view;uid=', $message['member']['id'], '"/>Blog</a></li>';


It's working as it should.  The example in the pic is of a member that has had 1000 name changes, and shows his changed username


wynnyelle

Hm, ok. I'll wipe the code I was using and just do a direct re-paste. I think I did something screwy when I was moving it around in different places.

Thank you for being patient with me.

hcfwesker

Also, something seems kinda strange when viewing any board on your site.  It's nothing to panic over, but some reason your topics don't show view count totals in the Replies/View colimn for any topic that's not a sticky, even if it has replies it only shows 0 views.

http://warriorcatsrpg.com/index.php?board=7.0

15 Replies
0 Views

Just seems strange since it has 15 replies it should have at least 15 views

wynnyelle

Yeah...we took that out to save space. We have some bad lag problems. It didn't work, but it'd be a pain to put them back :P

The code now I am trying on the profile and it only kind of....makes the entire profile not load at all? Just shows an error on a white screen of death. :P

This is the code I am trying to inset


echo'<li><a href="?action=pmxblog;sa=view;uid=', $message['member']['id'],'"><img src="/Images/blogicon.gif"/><span class="image_link">Blog</a></li>';

hcfwesker

ok, when you edit a code i supply, and complain it doesn't work, that's NOT my fault.  you're trying to insert an image which you have it all wrong in the way you're trying to.  post a link to the image so i can give you the correct code  none of your >  have closings on them like />  which i see you took out of my original code

hcfwesker

Try this code for the added image.  please try and specify all you're trying to do with something.  It just kinda irritates me to know my code was working when you say it doesn't then to see why, cause you were trying to add something to it that has no possible way of working with how you tried to modify it :P

                          // Member Blog Links ...
echo '
<li>View ', $message['member']['name'], '\'s <a href="', $scripturl, '?action=pmxblog;sa=view;uid=', $message['member']['id'], '"/><img src="', $settings['default_images_url'], '/blogicon.gif" />Blog</a></li>';


Make sure to have that blogicon image uploaded to your Themes/default/images folder

wynnyelle

I didn't take it out. I put some of your code into a part of code that I already had in there. I'm just trying to get this to work that is all.

It actually is working on the mini profile now, but it won't on profiles.

The image link is  http://dev.warriorcatsrpg.com/Images/blogicon.gif

I'm sorry if I didn't do this right.

wynnyelle

I added your code to the profile exacly, but now it white screen of death, and this exact error:

Parse error: syntax error, unexpected '>' in /home/develop/public_html/Themes/default/UltimateProfile.template.php on line 309

Please don't be mad...I really am trying, hard. I apologise if I did anything wrong this time.

hcfwesker

I know, and I commend you for trying.  but its the fact im running in circles trying to find out why my code doesnt work for you ... when i tested it an hour ago and it worked ... THEN to find out why it doesn't work for you, because you tried modifying it.

<img src="/Images/blogicon.gif"/>  <---  that will in no way produce an image

/Images/blogicon.gif   <---  according to how the above it written, that's suppose to be an image link, which it won't ever be

Quote from: Groovystar on April 15, 2013, 12:11:19 AM
I added your code to the profile exacly, but now it white screen of death, and this exact error:

Parse error: syntax error, unexpected '>' in /home/develop/public_html/Themes/default/UltimateProfile.template.php on line 309

Please don't be mad...I really am trying, hard. I apologise if I did anything wrong this time.

Ummmm ... i never said anything about profiles yet.  This is for mini-profiles like you originally asked


Advertisement: