Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Insert this code at line 175 of modules/blog/blog.module to create a blog module tab at user/%user. Remember to run update.php after saving the changes to the file.
$items['user/%user/blog'] = array(
'title' => 'Blog',
'page callback' => 'blog_page_user',
'page arguments' => array(1),
'access callback' => 'blog_page_user_access',
'access arguments' => array(1),//array('access content'),
'type' => MENU_LOCAL_TASK,
'file' => 'blog.pages.inc',
'weight' => '15',
);
You can change the tab's placement by adjusting the weight.
Here's a pic of what it looks like.
Comment | File | Size | Author |
---|---|---|---|
#12 | blog-user-tab-270457-012.patch | 612 bytes | karschsp |
blogtab.PNG | 151.54 KB | markpenny |
Comments
Comment #1
markpenny CreditAttribution: markpenny commentedSorry. Let me clean up that code a little. Same instructions.
Comment #2
mercmobily CreditAttribution: mercmobily commentedHi,
I think this patch is awesome. Any chances of getting this committed to D6?
Merc.
Comment #3
markpenny CreditAttribution: markpenny commentedThat would be nice. I'm not in the Drupal loop, so you'd have to go higher up. Would you like to take charge of lobbying?
Comment #4
mercmobily CreditAttribution: mercmobily commentedHi,
I would be happy to create a proper patch (it would go to the blog.module module).
The patch would need to add a checkbox somewhere for the blog module (where?), and if it's active, it would need to add the tab. It really is a trivial change.
I would be happy to do the patch against D6 if they told me that there is a chance of being accepted.
Merc.
Comment #5
lilou CreditAttribution: lilou commentedFeature request go to CVS/HEAD.
Comment #6
mercmobily CreditAttribution: mercmobily commentedHi,
I have looked into this issue a *lot*. I now realise that there is more than one issue in terms of having the full blog in the tab -- and it's enough of a headache to deserve a "no" from Drupal Core. I am saying this because if *I* were part of Drupal core, I'd refuse this patch.
For example:
* The link to the person's blog in general is to /blog/N and not /user/blog/N.
* It would tend to be confusing, having blogs in two different spots.
I am developing a web site where both blogs *and* blog entries are within a user's tab. But there's a lot of aliasing happening, and it's anything but simple.
Merc.
Comment #7
markpenny CreditAttribution: markpenny commentedI'm not quite sure I follow. No doubt you know what you're talking about. It's just a little beyond my current expertise.
From my point of view, there doesn't seem to be a problem with the patch as is.
Incidentally, I'm thinking of putting together a set of tab patches. You can check my profile to see what I've done so far. To date, each patch has to be added manually to the associated module file. I'd like to build something that can be installed separately from the modules it patches to. I'm thinking of calling it Tabulator or Tab-u-later or something. The simplest version would just be a module file with the patches commented out for selective enabling. A more advanced version would add an item to site configuration. Interested in working on that idea? I see you've got a fair bit of experience with contributed modules. I reckon you'd know what to do and how to do it.
Comment #8
mercmobily CreditAttribution: mercmobily commentedHi,
My comment in #6 is flawed. Sorry.
I was referring to the possibility that an administrator might possibly want to have their blogs ONLY in the user's profile. I actually managed... but what a struggle. I had to:
* Define two new menu entries:
* Define the function to feed these callbacks:
* KILL the default URLs. this is just to be tidy.
And then change the outbound links in settings.php:
After _all_ of this messy trouble, you have basically *caged* the blogs in the users' page. I am developing a site that is _all_ about user pages... and doing this makes sense.
I am not sure if this is even relevant. I think your aim is different: it's to *just* show the blog entries in the user's page. However, the minute you click on one of them, that's it.
I totally support your patch. but... you do realise that you can ontain what you want by just taking the right bits from my code above? Again, it would probably make sense for the blog module to have it... but this _can_ be done as a third party module. Just a t thought.
Bye,
Merc.
Comment #9
Dave ReidI'm in support of this and think we should *only* support user/%user/blog paths and not blog/%user. We don't even have to make it a tab, it can be a callback. Using the user/%user/blog makes it easier for modules like Sub-path URL alias to automatically extend the alias of user/%user to it's sub-path 'blog'.
Comment #10
gregglesI like this idea too, but it's probably an 8.x change now.
Comment #11
Dave ReidTagging as this would help us remove redundant code in pathauto.
Comment #12
karschsp CreditAttribution: karschsp commentedPatch attached. Go testbot go!
Comment #13
gregglesComment #14
deekayen CreditAttribution: deekayen commented#233301-125: Remove blog module from core removed blog from core.
Comment #15
nevergone CreditAttribution: nevergone commentedOutdated issue.