Skip to:
Content
Pages
Categories
Search
Top
Bottom

Modifying default widgets

  • @djpaul

    Keymaster

    OK I have spent this weekend working on modifying the default BP widgets. Some have been harder to customise than others.

    I am having lots of trouble getting the site activity midget changed to how I want it.

    bp-blogs.php, bp_blogs_format_activity().

    return array(

    'primary_link' => $blog_url,

    'content' => apply_filters( 'bp_blogs_new_blog_activity', sprintf( __( '%s created a new blog: %s', 'buddypress' ), $user_link, '' . $blog_name . '' ) . ' <span class="time-since">%s</span>', $user_link, $blog_url, $blog_name )

    );

    This bit <span class="time-since">%s</span> is where I’m up. I am assuming the %s goes through another sprinft() call on page generation. I need to know where and how, as it generates output like this which I need to change: &nbsp;& 10 minutes ago

    Please help

Viewing 11 replies - 1 through 11 (of 11 total)
  • @johnjamesjacoby

    Keymaster

    Looks like it’s going into bp_blogs_new_blog_activity to me?

    Do a find in the BP code for that function and see where other functions hook into it?

    Not sure what you use to code, but I use Notepad++ that has a “search through files” function so you don’t have to have all of the files open, and it will search through sub directories and you can filter for specific file types.

    @djpaul

    Keymaster

    I have tried looking, can’t find it, which is why i’m coming here hoping someone else knows where it is.

    The bp_blogs_new_blog_activity doesn’t put the actual timestamp into the message – that’s obviously done at runtime so that the “updated X hours ago” message is updated appropiately. The %s I mentioned is actually stored in the database like that so it goes through a sprintf()… somewhere.

    @johnjamesjacoby

    Keymaster

    My best guess would be to try and track something down into the bp-activity-templatetags.php file, somewhere in or around line 151 in function bp_activity_content_filter.

    I think that’s where the time gets inserted for most activities?

    @burtadsit

    Participant

    function bp_activity_content_filter( $content, $date_recorded, $full_name, $insert_time = true, $filter_words = true, $filter_you = true )

    It’s in bp-activity-templatetags.php. Sitewide activity widget calls that for all content being displayed. It updates the ‘time since’ %s placeholder.

    That should be the spot to modify it like John suggested. He does pretty well with notepad++.

    “somwhere around line 151” is a pretty exact somewhere. :)

    I’m fooling around with NetBeans IDE 6.5. It has it’s moments of usefulness.

    @johnjamesjacoby

    Keymaster

    ;)

    I’m not really sure what others use for their development processes, but I’ve had good luck with Notepad++, SmartFTP, WinMerge, WinRAR, and TortoiseSVN.

    I’ve also used Eclipse but I’ve never NEEDED to use it, so I don’t really know how to take advantage of it the way I probably should. I’ll check out NetBeans since you mention it.

    The one reason I feel I’m flying blind a little bit is because I really have no way to trace any functions back without manually opening files and checking out what they do. I suspect that an IDE will probably alleviate some of those problems for me.

    @burtadsit

    Participant

    The IDE approach helps alot with the ‘where is *that* thing’. Quick access to project files. Code completion. yada, yada.. Nothing that I can’t live without really. I’m just starting to try out debugging php web apps. I miss that kinda thing. Breakpoints, var inspection.

    I’ve tried Aptana PHP 1.0, NuSoft PhpED and now NetBeans. Aptana is plain broke in PHP 1.0 now. PhpED is good but costs. NetBeans seems good. They all have little differences that I got used to from one product to another. Somethings are easy and some are kinda buried somewhere.

    I really like hooking the IDE up to FTP and fixing something locally and just telling the IDE to upload the files I’m editing to the server. Cool.

    IDEs are certainly not necessary but helpful.

    @johnjamesjacoby

    Keymaster

    Yep, that’s exactly what I’d like to use it for, a little bit of transparency in the edit/upload area. I’ve done all my work from my laptop for about 5 years now, and while I will never go back to a desktop, I much prefer being at my desk at work where I can spread out across three monitors and have everything visible rather than alt tab madness editing and uploading.

    @burtadsit

    Participant

    NetBeans is kinda brain dead when it comes to hooking up a local file system to a remote file system and transferring the edited files. I had to go browsing around the net looking for a solution but got one that allows a hot key combo like ctrl-u or whatever you assign to that action. (upload current file in editor)

    The other IDEs implement it much more sanely than NetBeans. It’s like an after thought in this one. It works but it’s certainly not an intuitive feature without a couple of extra setup/config steps.

    @johnjamesjacoby

    Keymaster

    I really would like to try and setup Eclipse as my IDE of choice, but it’s actually so amazing and probably capable of doing so much cool stuff that I just can’t figure it out and haven’t had the time to sit down and try.

    Plus I always have like 4 website projects open at one time, and SmartFTP lets me browse as many remote and local connections as I need to have open at a time. It’s a funny feeling being an old dog that wants to learn new tricks some days. :)

    @burtadsit

    Participant

    djpaul, if this is still a question in your mind, turn the light back on. This has degenerated into off topic banter. :)

    @djpaul

    Keymaster

    Was resolved early on. Thanks.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Modifying default widgets’ is closed to new replies.
Skip to toolbar