Jump to content

custom variable Hook


TGK

Recommended Posts

Hi i created a custom page and im trying that my custom varible work in these custom page can some help me a bit.
custom page info:

withcrypto.php
template file:  withcrypto.tpl

 

<?php

# Cart Email Verification Hook
# Written by brian!

use Illuminate\Database\Capsule\Manager as Capsule;

function client_email_status_hook($vars) {
	$client = Menu::context("client");
	if ($client && $vars['templatefile'] == 'withcrypto') {
		$clientemails = Capsule::table('tblclients')->where('id',$client->id)->value('marketing_emails_opt_in');
		return array("clientemails" => $clientemails);
	}
}
add_hook('ClientAreaPage', 1, 'client_emails_status_hook');
?>

 

also i know that exist a {$marketing_emails_opt_in} variable but i dont know how to make work in my custom page.

 

thanks

Link to comment
Share on other sites

you wouldn't need a hook for this... if the client is logged in, then you can find out the information from an existing Smarty variable..

{if $loggedin}
	{if $clientsdetails.marketing_emails_opt_in}
		this client is opting in
	{else}
		this client is not opting in
	{/if}
{else}
	the client is not logged in
{/if}

so if the client is logged in and they have opted in to email marketing, it will output "this client is opting in"; if they have not opted in, it will output "this client is not opting in" and if they are not logged in, it will say "the client is not logged in".

you should then be able to adjust that {if} statement to cover what you want to do under those three circumstances.

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