Skip to:
Content
Pages
Categories
Search
Top
Bottom

@thepseudo in the posts


  • John
    Participant

    @johnwinch42

    Hello,

    I’m using buddypress with WordPress multi-blogging.

    When I write a comment on a post from the network’s blog with a mention @thepseudo in it , it’s creating a clickable link to the user (just like if I mentioned the user via the buddypress activity update). But If I try to write a post with this mention in it, it doesn’t work it’s simply displaying @thepseudo without any link.

    Any ideas on how to fix this ?

    Thanks you for your help.

    best regards,

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

  • Roger Coathup
    Participant

    @rogercoathup

    @johnwinch42

    ‘fix’ isn’t the right word, as it’s not really broken – in general, WordPress blog post text is left as the original author intended it to be written (with the exception of some meddling by Matt mullenweg).

    If you want to modify your blog posts to convert @pseudo references into clickable links, you can probably do it by filtering the blog content when it is saved.

    BuddyPress uses the function bp_activity_at_name_filter() to create those links. Take a look at it (it’s defined in bp-activity-filters.php) and see if you can adapt / use it for the filters on blog content saves.


    paulhastings0
    Participant

    @paulhastings0

    Sounds like it would be a cool plugin. I know a lot of users who would appreciate something like that.

    i *think* the filter to hook on is content_save_pre as the bp atname filter already hooks on comments -> `add_filter( ‘pre_comment_content’, ‘bp_activity_at_name_filter’ );`


    John
    Participant

    @johnwinch42

    @rogercoathup Sorry for the wrong use of the word, you’re right “fix” is not really the right word.

    @nuprn1 In what file can I see the filter applied to the blog’s comments ? This way I could see if I could adapt it to the post. Could you give me a clue where to do the modifications ?


    Roger Coathup
    Participant

    @rogercoathup

    If you are adding your own filters you can add them either in your theme’s function.php file or in bp-custom.php in your plugins folder.

    This article introduces you to the concept of filters in WordPress (albeit from a plugin perspective): https://codex.wordpress.org/Plugin_API#Filters

    To find the hook in question (content_save_pre), I suggest using your file editor and searching the files in your WordPress install. Also have a Google, and you’ll find some information: e.g. http://adambrown.info/p/wp_hooks/hook/content_save_pre?version=1.5.2&file=xmlrpc.php

    [Edit: Rich has already given you the line to add for the filter – try it in your functions.php]

    bp-activity/bp-activity-filters.php


    John
    Participant

    @johnwinch42

    @rogercoathup @nuprn1 Thanks you for your help ! I’ve add ` add_filter( ‘content_save_pre’, ‘bp_activity_at_name_filter’ ); ` in my bp-activity/bp-activity-filters.php. It’s working well but only apply with the new posts, the old mention @name are not clickable. It’s also not working on the post resume on the front page. Is there a way to do something about it ? (See I didn’t use the word “fix” :p )

    But when a new version of buddypress will be released I’ll loose the change ?


    Roger Coathup
    Participant

    @rogercoathup

    @johnwinch42 – check my previous comment, it tells you where to put the filter – you should avoid overwriting your core files.

    The filter is applied when posts are saved – so, no it won’t parse old posts, just new ones.

    For the resume, you’ll have to look at filtering the post excerpt.


    John
    Participant

    @johnwinch42

    @rogercoathup I’ve deleted the line from my bp-activity and I’ve add it to my bp-custom, it’s still working and I’ve tried to make the @mention in the post resume clickable with `. add_filter( ‘post_excerpt’, ‘bp_activity_at_name_filter’ ); `.

    It didn’t work, did I not use the right variable ?


    paulhastings0
    Participant

    @paulhastings0

    There’s a trac ticket for this that I opened a few months back: https://trac.buddypress.org/ticket/2380


    John
    Participant

    @johnwinch42

    Thanks for the link, does anyone have a solution about the notification ?
    With ` add_filter( ‘content_save_pre’, ‘bp_activity_at_name_filter’ ); `in bp-custom.php, my blog’s @mention are clickable but in buddypress the notification is not really working, any idea on what to add to bp-custom ?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘@thepseudo in the posts’ is closed to new replies.
Skip to toolbar