The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

"add friend" js code help

4 posters

Go down

Solved "add friend" js code help

Post by J0k3R^ May 11th 2014, 3:48 pm

Hi,
i added the codes from this tutorial to my forum
http://www.avacweb.com/t17p15-re-1-add-as-friend-and-user-wall-link-in-post-profiles
and it used to work but now my viewtopic_body is heavily edited and it doesnt appear. im using punbb. what should i do? 

i tried this code:

Code:
$(function(){
  ('Copyright ©️ AvacWeb. All Rights Reserved. Use and  modification of this script is not allowed without this entire copyright notice in the original, copied, or modified script. No distribution without consent.');
  var posts = $('.username', document.getElementById('main-content'));
  for(var i = 0, p; (p = posts[i++]); ) {
      var userlink = p.getElementsByTagName('a')[0], name = userlink.innerHTML.replace(/<[^>]+>/g, ''), uid = userlink.href.match(/[0-9]+$/)[0];
      $('.friendlink', p.parentNode.parentNode).html('<a href="/profile?friend=' + name + '&mode=editprofile&page_profil=friendsfoes">Add as Friend</a>');
      $('.walllink', p.parentNode.parentNode).html('<a href="/u' + uid + 'wall">' + name + '\'s Wall</a>');
  }
});

and this:

Code:

$(function(){
  var posts = $('.username', document.getElementById('main-content')), i = 0, p;
  for(; (p = posts[i++]); ) {
      var userlink = p.getElementsByTagName('a')[0]
      , name = userlink.innerHTML.replace(/<.*?>/g, '')
      , uid = userlink.href.match(/\d+$/)[0];
      p.parentNode.parentNode.innerHTML += '<a href="/profile?friend=' + name + '&mode=editprofile&page_profil=friendsfoes">Add as Friend</a><br><a href="/u' + uid + 'wall">' + name + '\'s Wall</a>';
  }
});

but nothing worked. i hope u help me Very Happy
J0k3R^
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: "add friend" js code help

Post by Ape May 11th 2014, 4:00 pm

This code no longer works right now LG is going to have a look at it when he gets the time.

The problem is down to the new editor system and the way codes are made and used.

Also FM made some little javascript Fixes not so long a go and this knocked some of the javascript's out from LG's systems.  This is a problem to lots of codes no longer working but one by one He is fixing them.

Ape


"add friend" js code help Left1212"add friend" js code help Center11"add friend" js code help Right112
"add friend" js code help Ape_b110
"add friend" js code help Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19084
Reputation : 1988
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: "add friend" js code help

Post by J0k3R^ May 11th 2014, 4:27 pm

this code used to work on my forum just some days ago (maybe a week) but i modify my viewtopic_body very often and i make new changes there so i think thats my problem..
J0k3R^
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: "add friend" js code help

Post by LGforum May 11th 2014, 8:53 pm

The code should still work on normal forums - however if you edit your templates, your responsible for editing Javascripts to meet your personalized site. This was mentioned in the tutorial that it likely won't work on PunBB boards with edited templates.

Someone with knowledge of Javascript may be willing to edit the script for you, but honestly you could probably find a decent way of adding the links in via templates.

LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

Solved Re: "add friend" js code help

Post by J0k3R^ May 11th 2014, 9:23 pm

Lol, im so dumb and i didnt even think about puting this at tempates.. Very Happy Very Happy 
its good, but what to write instead of  ' + name ' because it needs to be changed to make it work..

in here:
Code:
<a style="position:relative;top:1px;" href="/profile?friend=' + name + '&mode=editprofile&page_profil=friendsfoes">
J0k3R^
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: "add friend" js code help

Post by J0k3R^ May 13th 2014, 4:55 pm

Bump?
J0k3R^
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: "add friend" js code help

Post by J0k3R^ May 14th 2014, 6:55 pm

Bump
J0k3R^
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: "add friend" js code help

Post by J0k3R^ May 16th 2014, 6:44 pm

Bump
J0k3R^
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: "add friend" js code help

Post by J0k3R^ May 17th 2014, 6:42 pm

Bump
J0k3R^
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: "add friend" js code help

Post by J0k3R^ May 19th 2014, 6:17 pm

Bump
J0k3R^
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: "add friend" js code help

Post by LGforum May 20th 2014, 12:02 am

Sorry I don't visit this forum often.

Try putting this for a wall link:
Code:
<a href="/profile?friend={postrow.displayed.POSTER}&mode=editprofile&page_profil=friendsfoes">Add as Friend</a>

And try this for the wall:
Code:
<a href="/u{postrow.displayed.POSTER_ID}">Visit Wall</a>

These are just intuitive guesses however.
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

Solved Re: "add friend" js code help

Post by J0k3R^ May 20th 2014, 6:24 am

Thank you Smile
it works fine

$olved
J0k3R^
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: "add friend" js code help

Post by SLGray May 20th 2014, 7:07 am

Topic Solved & Archived


"add friend" js code help Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51464
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum