"add friend" js code help Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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.
4 posters

    "add friend" js code help

    J0k3R^
    J0k3R^
    Forumember


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

    Solved "add friend" js code help

    Post by J0k3R^ Sun 11 May 2014 - 15:48

    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
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19442
    Reputation : 2010
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: "add friend" js code help

    Post by Ape Sun 11 May 2014 - 16:00

    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
    J0k3R^
    J0k3R^
    Forumember


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

    Solved Re: "add friend" js code help

    Post by J0k3R^ Sun 11 May 2014 - 16:27

    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..
    LGforum
    LGforum
    Hyperactive


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

    Solved Re: "add friend" js code help

    Post by LGforum Sun 11 May 2014 - 20:53

    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.

    J0k3R^
    J0k3R^
    Forumember


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

    Solved Re: "add friend" js code help

    Post by J0k3R^ Sun 11 May 2014 - 21:23

    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

    Solved Re: "add friend" js code help

    Post by J0k3R^ Tue 13 May 2014 - 16:55

    Bump?
    J0k3R^
    J0k3R^
    Forumember


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

    Solved Re: "add friend" js code help

    Post by J0k3R^ Wed 14 May 2014 - 18:55

    Bump
    J0k3R^
    J0k3R^
    Forumember


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

    Solved Re: "add friend" js code help

    Post by J0k3R^ Fri 16 May 2014 - 18:44

    Bump
    J0k3R^
    J0k3R^
    Forumember


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

    Solved Re: "add friend" js code help

    Post by J0k3R^ Sat 17 May 2014 - 18:42

    Bump
    J0k3R^
    J0k3R^
    Forumember


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

    Solved Re: "add friend" js code help

    Post by J0k3R^ Mon 19 May 2014 - 18:17

    Bump
    LGforum
    LGforum
    Hyperactive


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

    Solved Re: "add friend" js code help

    Post by LGforum Tue 20 May 2014 - 0:02

    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.
    J0k3R^
    J0k3R^
    Forumember


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

    Solved Re: "add friend" js code help

    Post by J0k3R^ Tue 20 May 2014 - 6:24

    Thank you Smile
    it works fine

    $olved
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51561
    Reputation : 3524
    Language : English
    Location : United States

    Solved Re: "add friend" js code help

    Post by SLGray Tue 20 May 2014 - 7:07

    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.