The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

"add friend" js code help

View previous topic View next topic Go down

Solved "add friend" js code help

Post by J0k3R^ on 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^
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 on 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





APE
Manager
Manager

Male Posts : 8317
Reputation : 716
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

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

Back to top Go down

Solved Re: "add friend" js code help

Post by J0k3R^ on 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^
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 on 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
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: "add friend" js code help

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

Lol, im so dumb and i didnt even think about puting this at tempates.. Very HappyVery 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^
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^ on May 13th 2014, 4:55 pm

Bump?

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^ on May 14th 2014, 6:55 pm

Bump

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^ on May 16th 2014, 6:44 pm

Bump

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^ on May 17th 2014, 6:42 pm

Bump

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^ on May 19th 2014, 6:17 pm

Bump

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 on 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
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Solved Re: "add friend" js code help

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

Thank you Smile
it works fine

$olved

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 on May 20th 2014, 7:07 am

Topic Solved & Archived


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


SLGray
Administrator
Administrator

Male Posts : 35629
Reputation : 2372
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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