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.

Links to external sites in Profile

View previous topic View next topic Go down

Solved Links to external sites in Profile

Post by FiskBlack on August 1st 2016, 4:24 am

Hi there,

I'd like to create clickable fields in my Profiles, I know there is a contact tab for that, but I want to group this info, to show/use only the Profile tab.

Currently I have three fields set up with icons but they only shows the urls to the users profiles of other sites, I'd Like those urls to become links, with the images I already have.

I have tried editing the profile_add_body but I was only able to duplicate the edit profile, and not move the contacts to the profile page.

I think it is possible but, I'm not even close to understand how the coding works : /


Thank you for your help.
FiskBlack


Last edited by FiskBlack on August 2nd 2016, 3:17 am; edited 1 time in total

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 1st 2016, 5:29 am

@FiskBlack One of two things.

One: Give me the URL of your forum and a profile link where this is show (preferred).

Two: Give me a screenshot of what this is looking like.

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 1st 2016, 6:10 am

Sure thing. I'll PM you the stuff. Right now, I reverted the edit I did to the html. I filled some fields for this user, to simulate a normal user.

Thank you for taking interest in helping me.


Last edited by FiskBlack on August 1st 2016, 6:14 am; edited 2 times in total (Reason for editing : typo & edit)

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 1st 2016, 4:40 pm

Got the information from your private message @FiskBlack

ACP >> Modules >> HTML & Javascript >> Javascript codes management

Title: Profile Field Links
Placement: In all the pages
Code:
$('#profile-advanced-details .middleline').children("dl").each(function() {
  var $field = $(this).find(".field_uneditable").contents();
  $field.text().indexOf("http") > -1
    ? $field.wrap("<a href=" + $field.text() + "></a>")
    : ""
});

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 1st 2016, 4:53 pm

Thanks for the help Ace 1! I'm going to try this code right now.

Edit: i'm afraid it did not work. : (

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 1st 2016, 5:35 pm

Oh I completely forgot lol. Remember that this is ticked off


And also, replace the code above with the following.

Code:
$(function() {
  $('#profile-advanced-details .middleline').children("dl").each(function() {
    var $field = $(this).find(".field_uneditable").contents();
    $field.text().indexOf("http") > -1
      ? $field.wrap("<a href=" + $field.text() + "></a>")
      : ""
  });
});

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 1st 2016, 6:11 pm

It worked Ace 1, thank you! I might be asking too much, but could this script be tuned to open the links in new tabs and show the images instead of the text?

Thins may be too complex, but could the code be altered to only change specific fields in the html? (or this isn't needed?)
Example: the field id 'profile_field_13_1' correspond directly to the first text box, and profile_field_13_2 profile_field_13_3 to the next two.

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 1st 2016, 6:14 pm

Yeah, this is actually no problem at all.

Just replace line 5 of my code with this:

Code:
? $field.wrap("<a href=" + $field.text() + " target=\"_blank\"></a>")

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 1st 2016, 8:35 pm

Great, thanks Ace 1. About the image, is it possible to instead of showing the text, show an image?

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 1st 2016, 8:53 pm

@FiskBlack I don't know image you mean, but if you mean replacing the text with a certain image. You want different images for each of the fields, am I correct?

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 1st 2016, 9:34 pm

Yes, that's correct, I'd like to replace the fields for each site, with the image from each description.

If you log in again with the user I sent and go to the Contact page, you'll see there is a website field I left pre configured, I'd like to make a field that acts just like that in the Profile.

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 1st 2016, 10:32 pm

I don't understand; you already have the images there..

http://prntscr.com/c0dijl

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 1st 2016, 11:43 pm

In the meantime I found some codes on the net and a friend, who I did not know he knew some coding, so he also helped upgrading your code and we got it working.

I thank you for the help ofc, w/o your code I would not even know how start. : )

Here is the final result:
Spoiler:
Code:
$(function () {
    var count = 10;
    $('#profile-advanced-details .middleline').children("dl").each(function () {
        var $field = $(this).find(".field_uneditable").contents();
        var name = count + ".png";

        $field.text().indexOf("http") > -1
        ? $field.wrap("<a href=" + $field.text() + " target=\"_blank\"><img src='image_url_wo_extension" + name + "' /></a>")
          : "";
        count++;
    });
});

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 1st 2016, 11:50 pm

I don't get what
Code:
count
is doing but no problem. I like to help Wink

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 1st 2016, 11:58 pm

I don't really get how it works but, that count is controlling the numbers of the images, they follow a pattern ico1.png, ico2.png, ico3.png, so my image link is something like http://imagehost.com/ico1.png that src gets replaced by the 'http://imagehost.com/ico' and it gets the count + extension.

Do you see another alternative?

I hope this explanation didn't make thins more confusing hehe

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 2nd 2016, 12:10 am

Oh, I get what he did. And the only other alternative I see is to run a line of code for each field and give them a certain image.

And that code will only work if you have your image URLs ordered chronologically.

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 2nd 2016, 12:20 am

I see. If you still have some interest in this code, could you show me this version you said, this is probably the best option, and I'm interest in seeing/learning how it works : D

If I'm not being too greedy, and I think I am Embarassed , is it possible to change the code, to work with forum messages too?

Spoiler:

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 2nd 2016, 12:24 am

Enlighten me on what you mean by "messages".

Are you talking about the postprofile?

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 2nd 2016, 12:26 am

Yes, the post profile, I used 'messages' w/o noticing it, sorry.

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 2nd 2016, 12:49 am

@FiskBlack I adopted your code and changed it to fit for the post profile. The count idea is actually smart in your case.

Title: Post Profile Fields
Placement: In the topics

Code:
$(function() {
  $('.postprofile-details dd').each(function() {
    var $count = 10;
    $(this).last().contents().filter(function() {
      return this.nodeType == 3; // Gets Text Nodes
    }).each(function() {
      var $name = $count + ".png";
      $(this).text().indexOf("http") > -1 // If text node has "http"
        ? $(this).wrap("<a href=" + $(this).text() + " target=\"_blank\"><img src=\"http://i35.servimg.com/u/f35/19/51/61/55/favico" + $name + "\" /></a>")
        : "";
        $count++; // Iterates over 10, 11, and 12 file extensions
    });
  });
});

Sorry for the messiness. I tried to add comments so you could understand what's being done.

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 2nd 2016, 2:19 am

Thank you Ace 1! (I lost count of how many times I said it) cheers
It worked perfectly! Don't worry about the mess, its for a good reason.

I don't know how I can thank you enough for your huge help, is there any other way I can give you more rep? Good

I think this case is solved, and to be honest, you should make a tutorial post with this code, its worth it.
My friend does not have an account here but, you can add the user name, Usagipan for the additional credits.

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 2nd 2016, 2:44 am

Well...

 fufufu 

Thanks lol. Glad to help. And I don't know what you mean by tutorial.

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 2nd 2016, 2:59 am

Like the ones in the tips and tricks index

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by Ace 1 on August 2nd 2016, 3:14 am

I don't really know how to do those. I'll be fine. I don't really see any use for this, except on your forum.

Ace 1
Helper
Helper

Male Posts : 767
Reputation : 51
Language : English - French?
Location : Druid Hill Park

http://help.forumotion.com

Back to top Go down

Solved Re: Links to external sites in Profile

Post by FiskBlack on August 2nd 2016, 3:17 am

No problem, its your call. : )

I'll mark this topic as solved.

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

Solved Re: Links to external sites in Profile

Post by SLGray on August 2nd 2016, 5:04 am

Problem solved & topic archived.
Please read our forum rules:  ESF General Rules


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


SLGray
Administrator
Administrator

Male Posts : 36697
Reputation : 2445
Language : English
Location : United States

http://ztwds.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