Jump to content

Pull some code form custom field on profile page to make href on summary page.


intelweb

Recommended Posts

Hi everyone. I am a newbie to this so please go easy :)

 

I have been using WHMCS for a while as it makes life easy for a novice such as myself.

I have a little understanding of coding but nothing on par with some of you guys. I know this job is relatively easy and will potentially only take a few minutes to impermanent but unfortunately i haven’t the knowledge, hence why I’m posting on here.

 

Basically i have created a custom field which is showing up on the "Client Profile" page.

I have created a link on the "Client Summary" page but i was wondering if this link on the client summary page could be pulled from the website address i put into the custom field i have created in the profile:

 

EG: Currently my custom field on the profile page reads "AdWords Group"

I wish to add a website address into this field (without the http:// as WHMCS will not allow me to add this into there for some reason, I’m guessing security).

I then need to be able to click on my summary page, then by clicking on the link that says "Google Adwords" (See Attachment) it then just does a target blank, href to the webpage i have added into the custom field on the profile page.

 

Also, the link would need to add the https:// as the site i need to access won’t come up unless i have https:// in there.

So the href link would need to be something like {"https://" + "the url"} (which i have added in custom field box)"

 

Hope this make sense,

 

Any help would be greatly appreciated.

 

Thanks

 

whmcsforum.jpg

Link to comment
Share on other sites

{php}
$userid = $this->_tpl_vars['clientsdetails']['userid'];
$result = mysql_query("SELECT value FROM tblcustomfieldsvalues WHERE relid=$userid AND fieldid=###");
$data = mysql_fetch_array($result);
$value = $data[“value"];
echo $value;
{/php}

 

Just change ### with the field id. and put that on the template which you want to show the link on.

 

It should work however I did not test it. If you want a paid help please post on Marketplace forum and you will get a quotes for a lot of WHMCS professionals to help you on this.

Link to comment
Share on other sites

Hi

 

Many thanks for the reply.

 

I have tried adding the code on the clientsummary.tpl file, as detailed above but it seems to bring back a blank screen for some reason. Should i be putting the code above inside any html tags or anything?

 

I believe my custom client field is 24? so i tried adding the code as follows, would this be right:

{php}

$userid = $this->_tpl_vars['clientsdetails']['userid'];

$result = mysql_query("SELECT value FROM tblcustomfieldsvalues WHERE relid=$userid AND fieldid=24");

$data = mysql_fetch_array($result);

$value = $data[“value"];

echo $value;

{/php}

 

Any further help would be greatly appreciated.

 

Thanks again

 

I will also post in the marketplace as suggested too in case anyone can help for a small fee. thanks

Link to comment
Share on other sites

Hi

 

Thanks again for the reply.

 

After following the instructions above i get the error message as follows:

 

Parse error: syntax error, unexpected '"', expecting ']' in /home/admin/templates_c/%%28^287^28710B50%%clientssummary.tpl.php on line 110

 

Thanks again

Link to comment
Share on other sites

Can you please check what is in line 110 on the template file.

 

I believe it says:

<tr><td>{$_ADMINLANG.clients.creditbalance}</td><td>{$stats.creditbalance}</td></tr>

 

whmcsfo1.jpg

 

Thanks again

 

Mark.

 

PS: I notice in the error message it says:

Parse error: syntax error, unexpected '"', expecting ']' in /home/admin/templates_c/%%28^287^28710B50%%clientssummary.tpl.php on line 110

 

When checking I dont seem to have a "home/admin/templates_c" folder

I have "home/templates_c" folder which includes an index.php file in there?

 

This is the whmcs root/admin folder (which i presume is "home/admin")

whmcsfo2.jpg

 

Thanks again.

Link to comment
Share on other sites

I will need to have a closer look at the installation to find the cause of error.

 

It could be that you are checking the original file now which don't have the code I gave your. Add the code again and check the error and find on that line what is the code.

 

I suspect that there is a PHP code at that line. now it is just smarty syntax.

Link to comment
Share on other sites

Thanks intelweb.

 

Just for who want to use the same thing, this is the code:

{php}
$userid = $this->_tpl_vars['clientsdetails']['userid'];
$result = mysql_query("SELECT value FROM tblcustomfieldsvalues WHERE relid=$userid AND fieldid=###");
$data = mysql_fetch_array($result);
$value = $data['value'];
$this->assign('fieldlink',$value); 
{/php}

Then just use

{$fieldlink}

as a normal smarty variable.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated