SMFHacks.com

Modifications/Themes => Modifications Talk => Latest Mods => Topic started by: doctoreast on January 10, 2007, 11:30:25 pm

Title: Need Menu Button For SIMPLE BLOG
Post by: doctoreast on January 10, 2007, 11:30:25 pm
Hi,

   Am I in the right forum? 
 
   If any of you are using simple blog, you've noticed
no link on the main menu for it, but there is a page
named: http://YOURWEBSITE/forum/index.php?action=blog
 with someone's name on it, never finished. 

  This page needs to ask for login/registration if not logged,
and then to take you to your freakin blog page.  Does anyone
know how to do this?  I did a temporary thing, where I'm
sending them to the profile page, which has a link to blog,
but that only works if members are logged, and so it's truly
sad that someone hasn't fixed that page.

EAst
Title: Re: Need Menu Button For SIMPLE BLOG
Post by: doctoreast on January 14, 2007, 07:39:37 pm


   Anyone there ?

  Can someone help to fix action=blog page?

East
Title: Re: Need Menu Button For SIMPLE BLOG
Post by: SMFHacks on January 14, 2007, 08:15:03 pm


   Anyone there ?

  Can someone help to fix action=blog page?

East
Thta is not meant to work. Its empty. You access a blog though your profile. Or a user's profile.
Title: Re: Need Menu Button For SIMPLE BLOG
Post by: doctoreast on January 14, 2007, 09:14:55 pm
Sir,
   I beg to differ.  Blogs are a very seductive addition for any website;
and therefore I need a Blog Link on my main menu.  Not some link to
to the base of the profile page which gives you an error screen if you
aren't logged in.

  Can you move this to improvements, maybe, that others can consider this?
I'd like to see the blog page have a login/register prompt and then the blog page,
not the profile page.

  My site was dead until I added blogs.  Members are all active daily now, that
I've added blogs.  I need this link on main menu please.

East
Title: Re: Need Menu Button For SIMPLE BLOG
Post by: SMFHacks on January 14, 2007, 09:43:09 pm
In the future the blog mod needs to really be redone. I took it over from another guy who left.
Title: Re: Need Menu Button For SIMPLE BLOG
Post by: doctoreast on January 14, 2007, 11:01:56 pm

Hi,
   I looked for the original guy, but his email and website is down.  I posted this same request over on SMF also.   Seriously, Simple Blog has turned out to be the winning edge for my website.  It's a health support group with the SMF forum, blog, and coppermine gallery.  I never realize that people were attracted to blogs, but it seems to build character, makes people feel like they make a difference in the world, broadcasting, activism, that sort of thing.

  Please consider this development, fix the bad page (action=blog) to prompt for register/login, and then send them to their blog page.  Their blog page also needs a default starter right content of some kind.  Look at a new member blog, empty right column, and you'll see what I mean.  ../forum/index.php?action=blog

East




In the future the blog mod needs to really be redone. I took it over from another guy who left.
Title: Re: Need Menu Button For SIMPLE BLOG
Post by: Eliana Tamerin on January 28, 2007, 07:39:41 am
The solution here requires a bit of work and patience. There is a way to make a blog menu link. It all depends on whether your skin works on image or text buttons. I'm going to write this for the default theme for SMF.

Open up your FTP client and go to your forum's home directory. From there go to Themes and then your theme's folder. Open index.template.php in a text editor.

Find the line that says '// Edit Profile'. We're going to use this as a template to create our link for the blog link. Copy the entire text between '// Edit Profile' and '// Go to PM center'. Paste the copied text in between those two blocks of code.

The current text should look like this:
Code: [Select]
// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo ($current_action == 'profile' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'profile' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>
</td>' , $current_action == 'profile' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

Now, let's adapt this for our use. We can ignore the comment in the first line, that won't affect our link. The first thing we need to edit is the action text. Change this line:
Code: [Select]
echo ($current_action == 'profile' || $context['browser']['is_ie4']) ?to this:
Code: [Select]
echo ($current_action == 'viewblog' || $context['browser']['is_ie4']) ?
Do that anywhere it says $current_action == 'profile'. There's 3 places total.

Now we need to change the URL to link our users to the blog. Find this line here:
Code: [Select]
<a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>
Here's where it gets tricky. If you are using a theme other than the default, pay attention to the how the address is written. I'm going to break it down so you can understand it.
Code: [Select]
<a href="This is your basic HTML opening link statement.
Code: [Select]
', $scripturl,This is the url of your index.php for your forum.
Code: [Select]
'?action=profileThis tells the forum which page to load.
Code: [Select]
">This is your basic HTML closing link statement.

Ok, now we need to edit the link. We only need to change one part, but it can be confusing. The line you need to write is this:
Code: [Select]
<a href="', $scripturl, '?action=viewblog;u='. $context['user']['id'] .  '">' , $txt[79] , '</a>
Don't forget the '' single quotes around the . $context['user']['id'] .  part, otherwise your theme will be messed up. Some themes only require part of this code, depending on their structure. If you are using any other theme than the default one, and have problems, let me know which theme and I'll write this for that theme.

Now, there's one more part of this we need to do. Your link is coded, but it will say PROFILE on your menu if you don't change the link text. So let's do that now. Change this:
Code: [Select]
<a href="', $scripturl, '?action=viewblog;u='. $context['user']['id'] .  '">' , $txt[79] , '</a>to this:
Code: [Select]
<a href="', $scripturl, '?action=viewblog;u='. $context['user']['id'] .  '">' , 'BLOG' , '</a>
Your final edited text should look something like this:
Code: [Select]
// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo ($current_action == 'viewblog' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'viewblog' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=viewblog;u='. $context['user']['id'] .  '">' , 'BLOG' , '</a>
</td>' , $current_action == 'viewblog' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

You can change the comment (the first line) if you want, but keep the '// ' there to keep the text commented out, otherwise you'll get errors. I'm not sure if simpleblog has a view permission statement, so you can just leave the view profile permission statement there. If you really want it changed, you can say this:
Code: [Select]
if ($context['user']['is_logged'])instead. Now save your file and view your forum. You should have a link that says BLOG right next to your profile link. If so, good job. If it doesn't work or you get errors, reply here and I'll help you out. Tell me what theme you're using too, and attaching the index.template.php file can help as well.

Have fun with this.
Title: Re: Need Menu Button For SIMPLE BLOG
Post by: doctoreast on January 28, 2007, 08:22:56 am
Eliana,
  Wow, works beautifully.  Is there some way to keep the
button always visible?  If clicked while not logged, I was previously
using error message #453, which I have modified to say:
$txt[453] = 'Please Login? Otherwise, this profile is not available.';
Either something like that, or can it just redirect to the login page?
This is why I was asking about the index.php?action=blog page,
which is already there, just unfinished.  How would you do it, if
this were a permenant resolve (menu button)?
  Thank you so much, and I have published the patch. Too, be
sure that you get with user:smfhacks, to see if he wants to add
the patch to the next update.
Thanks,
Mike
Title: Re: Need Menu Button For SIMPLE BLOG
Post by: Eliana Tamerin on January 28, 2007, 08:53:09 am
For that you would have to edit the simpleblog.php itself. When you click the link while not logged in, it would direct you to 'http://path.to.your/forum/index.php?action=viewblog;u='. You just have to edit the error message to include a refresh code to take the user to a login page or display the standard 'No profile selected' message.

And yeah, not sure why action=blog is there anyways. It seems silly to have action=blog and action=viewblog both, but that's how Little15 coded it. I'm hoping SMFHacks will revamp it to consolidate the page to just action=blog and go on from there.
Title: Re: Need Menu Button For SIMPLE BLOG
Post by: doctoreast on January 28, 2007, 12:54:40 pm
Tamerin,

  This desperately needs attention, IMO.  Blogs really help with certain website traffic, very attractive. Action=blog page should/could handle all of it, is what I'm thinking;  redirect weather logged or not.  It's odd that there's absolutely no blog menu link at all, except as a footer on the profile page. It doesn't even belong there.
  Again, thanks for your support, and "works like a charm".

Doc