Support Forum

Links to Facebook, Linkedin etc

SP Stefano Prete
Stefano Prete
Member

Hi guys.

I have a small problem and I hope someone will help me to solve.

I have a plugin installed, called WP-Biographia. Really nice, it puts small icons to the bottom of each post/page. They are linked to Facebook, Linkedin and so on.

The links required must be like “http://www.facebook.com/stefano”. They must be written inside the user profile. Unfortunately, SP reads those URL and the identities don’t work. SP needs just “/stefano”. But if I put “/stefano” in SP, the links in WP-Biographia don’t work anymore! Pretty much, WP reads the links from SP.

Same thing with Linkedin, Google+ etc.

Is there a way to modify the system somewhat, so they will both work?

Thank you very much.

17 Answers

New Answer

MP Mr Papa
Mr Papa
Member

sorry, not really following you….  can you explain further what you are doing?

we already have identities like that in our profile… and displayed in the user info for each post…

are you saying that this other plugin is using the same data fields in a users db info for those fields?

SP Stefano Prete
Stefano Prete
Member

I don’t know how it works, Steve…

Let’s use my Linkedin account… The link is http://www.linkedin.com/in/stefanoprete

In the SP user profile we need to put only /in/stefanoprete and it works perfectly.

But in the WP user profile (that’s where WP-Biography gets the link from) we need to put http://www.linkedin.com/in/stefanoprete

So I did that. But when I do, the links in the SP profiles return a 404, because the link shown becomes http://www.linkedin.com/problem-with-post-edit-buttonttp://www.linkedin.com/in/stefanoprete

So it’s like SP already add http://www.linkedin.com automatically.

I hope I have been able to explain myself better this time…

MP Mr Papa
Mr Papa
Member

yes, we automatically add the base url in…  but that does mean what I asked… that somehow, that other plugin and simple press has chose the same db table and db entry name for the options…  not easy to occur. ;)

and no easy way around…  we wont be changing ours because way too many users already using it and we cannot break it for them…

best I can offer you currently, is to filter each of those urls to clean them up.  in other words, go ahead and require the full url in the sp profile… as you note, you end up with:

http://www.linkedin.com/problem-with-post-edit-buttonttp://www.linkedin.com/in/stefanoprete

the you can use the ‘sph_PostIndexUserLinkedIn’ filter to clean up the url for simple press…

there is a similar filter for each of the identities… see:  http://codex.simple-press.com/codex/api/template-functions-and-the-api/display-template-functions/topic-view/

SP Stefano Prete
Stefano Prete
Member

Steve…Sorry, but I am really dumb…

I went there, looked at everything and I have NO IDEA about what I need to do…

I don’t know which code i need to put and where…frown

MP Mr Papa
Mr Papa
Member

something like this for linked in…

add_filter('sph_PostIndexUserLinkedIn', 'my_ln_url');
function my_ln_url($content) {
    $content = str_replace('http://www.linkedin.com/problem-with-post-edit-buttonttp://www.linkedin.com/in/', 'http://www.linkedin.com/in/', $content);
    return $content;
}

then repeat (with proper hook) for other identities…

this would go in your spFunctions.php file of your sp theme…  as always, make sure you have your own sp theme and are not editing ours…

SP Stefano Prete
Stefano Prete
Member

Steve, it doesn’t work…

I have added this:

add_filter('sph_PostIndexUserLinkedIn', 'my_ln_url');
function my_ln_url($content) {
    $content = str_replace('http://www.linkedin.com/problem-with-post-edit-buttonttp://www.linkedin.com/in/', 'http://www.linkedin.com/', $content);
    return $content;
}

and the URL become http://www.linkedin.com/problem-with-post-edit-buttonttp://www.linkedin.com/in/stefanoprete

We need to find a way to remove the first http://www.linkedin.com
MP Mr Papa
Mr Papa
Member

well sounds like that means the other plugin is running late.. after our stuff…  so you might try

add_filter('the_content', 'my_ln_url', 9999);
function my_ln_url($content) {
    $content = str_replace('http://www.linkedin.com/problem-with-post-edit-buttonttp://www.linkedin.com/in/', 'http://www.linkedin.com/in/', $content);
    return $content;
}

and catch it after everyone is done mucking with the content…  I have no way to test this, so kind of shooting in the dark…

MP Mr Papa
Mr Papa
Member

then I am afraid I do not understand how they are getting the extra links in there…

are you sure the pattern you gave me is correct?  it must be exact, because we are searching for that string in the page content to replace it… not sure how it would not be found…

SP Stefano Prete
Stefano Prete
Member

Steve, I really don’t know…

What I need to do is the link in the user’s profile to work. The small icons below your picture on the left.

MP Mr Papa
Mr Papa
Member

yes, I understood that…

please post back here the code I gave you that you posted… use the code button in the editor…

all it does is search for the string you gave me (I have to assume you gave me the correct string) and replace it with the shortened url…

SP Stefano Prete
Stefano Prete
Member

Steve, I used this code:

add_filter('the_content', 'my_ln_url', 9999);
function my_ln_url($content) {
    $content = str_replace('http://www.linkedin.com/problem-with-post-edit-buttonttp://www.linkedin.com/in/', 'http://www.linkedin.com/in/', $content);
    return $content;
}

I have also tried like this:

add_filter('the_content', 'my_ln_url', 9999);
function my_ln_url($content) {
    $content = str_replace('http://www.linkedin.com/problem-with-post-edit-buttonttp://www.linkedin.com/in/', '', $content);
    return $content;
}

and like this:

add_filter('the_content', 'my_ln_url', 9999);
function my_ln_url($content) {
    $content = str_replace('http://www.linkedin.com/problem-with-post-edit-buttonttp://www.linkedin.com/in/', '/', $content);
    return $content;
}

but none of them seems to work...
MP Mr Papa
Mr Papa
Member

so all three of those search for

http://www.linkedin.com/problem-with-post-edit-buttonttp://www.linkedin.com/in/

is that really the string we are looking for?  check the source of you page and make sure that is the exact url we are looking for.

The last two would not be correct… but did they have any effect?

what if you go to forum – integration – page and permalink and turn on the strict wp api opion?

SP Stefano Prete
Stefano Prete
Member

Steve, I turned on the strict wp api and the template got all messed up!

I looked at the source of the Linkedin icon and the URL is

http://linkedin.com/problem-with-post-edit-buttonttp://www.linkedin.com/in/stefanoprete

The last 2 (not correct) didn’t have any effect at all.