Skip to:
Content
Pages
Categories
Search
Top
Bottom

Blog Call

  • Avatar of Famous
    Famous
    Participant

    @famous

    In an MU install, how do I call a users blog? Is there a code snippet that will call a users blog from any page on the site?

    I was trying to do it with this:
    bp_blog_permalink();

Viewing 8 replies - 1 through 8 (of 8 total)
  • Avatar of Paul Gibbs
    Paul Gibbs
    Keymaster

    @djpaul

    If you want the actual front end templates rendered, then that’s quite complicated. Your function above would just return a link to the blog. What are you trying to do?

    Avatar of Famous
    Famous
    Participant

    @famous

    I am trying to enable it so a user on any blog (on the MU platform) & or page on the site can return back to their blog with one clickable link in the sidebar or header.
    Any ideas on how best to accomplish this?

    Thanks @djpaul

    Avatar of valuser
    valuser
    Participant

    @valuser

    This MAY work for you.

    `

    ID ; $user_blogs = get_blogs_of_user( $user_id ); foreach ($user_blogs AS $user_blog) {$user_blog->siteurl; break;} $link = $user_blog->siteurl;$title = “My Very Own Blog”; $var = “$title“; echo “$var”; ?>

    `

    Not a coder so it probably could be cleaned up !

    Avatar of Famous
    Famous
    Participant

    @famous

    @valuser that is fantastic. If you can accomplish that you can’t sell yourself short, maybe you’re more of a programmer than you think.

    Got one last request – I need it to point to a directory, for instance:
    `<a href='$link/directory'`

    any ideas on how to complete that?

    Avatar of valuser
    valuser
    Participant

    @valuser

    I don’t quite follow.As far as i can recall i had tested this on multisite & on multisite/multinetwork.

    The code (i think) gets all blogs of the user but “breaks” or stops at the first which is the users main blog.

    Thus the eventual `$link = $user_blog->siteurl;’

    returns the site url of the primary blog of the user .

    So on multisite subdirectories it would return http://mydomain.com/theblogaddressofcurrentuser/

    or on multisite subdomain it would return http://theblogaddressofcurrentuser.mydomain.com/

    so Famous, if the setup was subdirectories and your blog (sub)address was famous, you would go to http://mydomain.com/famous/

    and

    If the setup was subdomains and your blog (sub)address was famous, you would go to http://famous.mydomain.com/

    Avatar of Famous
    Famous
    Participant

    @famous

    I probably worded that a little difficult. What I meant was that it works great. I just want it to point to a page as it hits the blog.

    So for instance:

    http://mydomain.com/famous/page1.php

    Avatar of valuser
    valuser
    Participant

    @valuser

    late here. so off the top of my head you will have to mess with `$var = “<a href='$link'`

    you have to add /page1.php (that is of course if page1.php is the same for all user blogs) to `’$link’` it could be `’$link./page1.php’` or ` ‘$link’.’/page1.php’`

    mess around with it as i will tomorrow but this is where lack of formal training shows up. A coder reading this would do it in a flash. The dot in .php could be messing it up. Hopefully an angel coder will see this post, smile and make it beautiful!

    Avatar of Famous
    Famous
    Participant

    @famous

    @valuser – today you happen to be my angel coder, so thanks.

    It’s probably not the technically correct way, but I used:
    `href=’$link/page”`

    since we don’t have to use the .php anyway and it worked. Who knew.

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.