newsletter subscription not working in all pages. no newsletter confirmation mail send to customers
<div class="custom-subscribe">
<div class="title">
<span><?php echo $this->__('Newsletter') ?></span>
</div>
<form action="<?php echo $this->getFormActionUrl() ?>" method="post" id="newsletter-validate-detail">
<div class="form-subscribe-header">
<label for="newsletter"><?php echo $this->__('Sign Up for Our Newsletter:') ?></label>
</div>
<div class="input-box">
<input type="text" name="email" id="newsletter" title="<?php echo $this->__('Sign up for our newsletter') ?>" class="input-text required-entry validate-email form-control" />
</div>
<div class="actions">
<button type="submit" title="<?php echo $this->__('Subscribe') ?>" class="button"><span><span><?php echo $this->__('Subscribe') ?></span></span></button>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail');
//]]>
</script>
Please check below solutions:
In the Magento backend "System > Permissions > Variables" and "System > Permissions > Blocks"
Add newsletter/subscribe and refreshed cache.
More info:
There is a new check on the template directive, see Mage_Core_Model_Email_Template_Filter::blockDirective() line 176
if ($this->_permissionBlock->isTypeAllowed($blockParameters['type'])) {
$type = $blockParameters['type'];
$block = $layout->createBlock($type, null, $blockParameters);
}
Also check in system configuration as below:
System--->Advanced--->Advanced
I have almost done a successful first time plugin, but unfortunately I cannot submit my updated values to the array I've created upon my register_activation_hook.
I need some insights in how Wordpress can handle all the dirty work - or will a $_POST be a better way to do it?
Below you'll see my admin.php which handles all admin related stuff.
<?php
// Meaning of abbreviations:
// clsc = Custom login shortcode
// Runs when plugin is activated
register_activation_hook( PLUGIN_MAIN_FILE, 'clsc_install');
// Create new database fields
function clsc_install() {
$clsc_options = array(
'Login_link' => '/log-in/',
'Login_string' => __('Log in', 'clsc'),
'Login_class' => '', // Default is empty to inherit theme styles
'Logout_link' => wp_logout_url( home_url()),
'Logout_string' => __('Log out', 'clsc'),
'Logout_class' => '', // Default is empty to inherit theme styles
'Account_link' => '/my-account/',
'Account_string' => __('My Account', 'clsc'),
'Account_class' => '' // Default is empty to inherit theme styles
);
add_option('clsc_options_array', $clsc_options, '', 'yes');
}
// Create admin option page
function add_clsc_option_page() {
add_options_page(
'Custom Login', // The text to be displayed in the title tag
'Custom Login', // The text to be used for the menu
'administrator', // The capability required to display this menu
'custom-login-shortcodes', // The unique slug name to refer to this menu
'clsc_html_page'); // The function to output the page content
}
/* Call the html code */
add_action('admin_menu', 'add_clsc_option_page');
// Enqueue admin styles and scripts
function clsc_enqueue_scripts() {
global $wpdb;
$screen = get_current_screen();
if ( $screen->id != 'settings_page_custom-login-shortcodes' ) {
return; // exit if incorrect screen id
}
wp_enqueue_style( 'brokenfruit-shortcodes-styles', plugins_url( 'admin/css/admin_styles.css', dirname(__FILE__) ) );
wp_enqueue_style( 'bootstrap', plugins_url('admin/css/bootstrap.css', dirname(__FILE__) ) );
wp_enqueue_script('admin_js_bootstrap_hack', plugins_url('admin/scripts/bootstrap-hack.js', dirname(__FILE__) ) );
}
add_action('admin_enqueue_scripts', 'clsc_enqueue_scripts' );
// Build admin interface
function clsc_html_page(){
$options = get_option('clsc_options_array');
?>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>
<div class="bootstrap-wrapper">
<div class="row">
<div class="col-md-12">
<h1><?php _e('Custom Login Shortcode','clsc'); ?></h1>
<p><?php _e('To use for shortcode:','clsc'); ?><br/><span class="shortcode-preview">[custom_login]</span></p>
</div>
</div>
<div class="row" id="login-content">
<div class="col-md-4">
<h5><?php _e('Log in link:','clsc'); ?></h5>
<input placeholder="<?php _e('Example: /log-in/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_link']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log in string:','clsc'); ?></h5>
<input placeholder="<?php _e('Example: Log in', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log in class:','clsc'); ?></h5>
<input placeholder="<?php _e('Example: login_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_class']; ?>" />
</div>
</div>
<div class="row top-buffer" id="logout-content">
<div class="col-md-4">
<h5><?php _e('Log out link:','clsc'); ?></h5>
<input placeholder="<?php _e('Example: /log-out/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_link']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log out string:','clsc'); ?></h5>
<input placeholder="<?php _e('Example: Log out', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log out class:','clsc'); ?></h5>
<input placeholder="<?php _e('Example: logout_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_class']; ?>" />
</div>
</div>
<div class="row top-buffer" id="account-content">
<div class="col-md-4">
<h5><?php _e('Account link:','clsc'); ?></h5>
<input placeholder="<?php _e('Example: /my-account/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_link']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Account string:','clsc'); ?></h5>
<input placeholder="<?php _e('Example: My Account', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Account class:','clsc'); ?></h5>
<input placeholder="<?php _e('Example: account_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_class']; ?>" />
</div>
</div>
<div class="row top-buffer">
<div class="col-md-12">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="clsc_options_array" />
<input class="btn btn-primary top-buffer" type="submit" value="<?php _e('Save Changes') ?>" />
</div>
</div>
</div>
</form>
<?php
}
?>
Feedback for alternative approaches are more than welcome!
I thank you all in advance and have a great day! :)
I have update function clsc_html_page() and added action 'admin_init' to save register your setting fields.
/**
Plugin Name: clsc
Plugin URI: http://google.com/
Description: this is description
Version: 1.0
Author: authourname
Author URI: http://authoururri.com/
License: GPLv2 or later
Text Domain: text domain
*/
// Runs when plugin is activated
register_activation_hook( PLUGIN_MAIN_FILE, 'clsc_install');
// Create new database fields
function clsc_install() {
$clsc_options = array(
'Login_link' => '/log-in/',
'Login_string' => __('Log in', 'clsc'),
'Login_class' => '', // Default is empty to inherit theme styles
'Logout_link' => wp_logout_url( home_url()),
'Logout_string' => __('Log out', 'clsc'),
'Logout_class' => '', // Default is empty to inherit theme styles
'Account_link' => '/my-account/',
'Account_string' => __('My Account', 'clsc'),
'Account_class' => '' // Default is empty to inherit theme styles
);
add_option('clsc_options_array', $clsc_options, '', 'yes');
}
add_action('admin_init','admin_init_register_setting');
function admin_init_register_setting()
{
// register your plugins settings
/*register_setting('wp_plugin_template-group', 'Account_class');
register_setting('wp_plugin_template-group', 'Account_string');
register_setting('wp_plugin_template-group', 'Account_link');
register_setting('wp_plugin_template-group', 'Logout_class');
register_setting('wp_plugin_template-group', 'Logout_string');
register_setting('wp_plugin_template-group', 'Logout_link');
register_setting('wp_plugin_template-group', 'Login_class');
register_setting('wp_plugin_template-group', 'Login_string');
register_setting('wp_plugin_template-group', 'Login_link'); */
register_setting('wp_plugin_template-group', 'clsc_options_array');
}
// Create admin option page
function add_clsc_option_page() {
add_options_page(
'Custom Login', // The text to be displayed in the title tag
'Custom Login', // The text to be used for the menu
'administrator', // The capability required to display this menu
'custom-login-shortcodes', // The unique slug name to refer to this menu
'clsc_html_page'); // The function to output the page content
}
/* Call the html code */
add_action('admin_menu', 'add_clsc_option_page');
// Enqueue admin styles and scripts
function clsc_enqueue_scripts() {
global $wpdb;
$screen = get_current_screen();
if ( $screen->id != 'settings_page_custom-login-shortcodes' ) {
return; // exit if incorrect screen id
}
wp_enqueue_style( 'brokenfruit-shortcodes-styles', plugins_url( 'admin/css/admin_styles.css', dirname(__FILE__) ) );
wp_enqueue_style( 'bootstrap', plugins_url('admin/css/bootstrap.css', dirname(__FILE__) ) );
wp_enqueue_script('admin_js_bootstrap_hack', plugins_url('admin/scripts/bootstrap-hack.js', dirname(__FILE__) ) );
}
add_action('admin_enqueue_scripts', 'clsc_enqueue_scripts' );
function clsc_html_page()
{
if(!current_user_can('manage_options'))
{
wp_die(__('You do not have sufficient permissions to access this page.'));
}
?>
<div class="wrap">
<form method="post" action="options.php">
<?php
$options = get_option('clsc_options_array');
#settings_fields('wp_plugin_template-group'); ?>
<?php #do_settings_fields('wp_plugin_template-group'); ?>
<div class="bootstrap-wrapper">
<div class="row">
<div class="col-md-12">
<h1><?php _e('Custom Login Shortcode','clsc'); ?></h1>
<p><?php _e('To use for shortcode:','clsc'); ?><br/><span class="shortcode-preview">[custom_login]</span></p>
</div>
</div>
<div class="row" id="login-content">
<div class="col-md-4">
<h5><?php _e('Log in link:','clsc'); ?></h5>
<input name="clsc_options_array[Login_link]" placeholder="<?php _e('Example: /log-in/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_link']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log in string:','clsc'); ?></h5>
<input name="clsc_options_array[Login_string]" placeholder="<?php _e('Example: Log in', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log in class:','clsc'); ?></h5>
<input name="clsc_options_array[Login_class]" placeholder="<?php _e('Example: login_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_class']; ?>" />
</div>
</div>
<div class="row top-buffer" id="logout-content">
<div class="col-md-4">
<h5><?php _e('Log out link:','clsc'); ?></h5>
<input name="clsc_options_array[Logout_link]" placeholder="<?php _e('Example: /log-out/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_link']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log out string:','clsc'); ?></h5>
<input name="clsc_options_array[Logout_string]" placeholder="<?php _e('Example: Log out', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log out class:','clsc'); ?></h5>
<input name="clsc_options_array[Logout_class]" placeholder="<?php _e('Example: logout_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_class']; ?>" />
</div>
</div>
<div class="row top-buffer" id="account-content">
<div class="col-md-4">
<h5><?php _e('Account link:','clsc'); ?></h5>
<input name="clsc_options_array[Account_link]" placeholder="<?php _e('Example: /my-account/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_link']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Account string:','clsc'); ?></h5>
<input name="clsc_options_array[Account_string]" placeholder="<?php _e('Example: My Account', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Account class:','clsc'); ?></h5>
<input name="clsc_options_array[Account_class]" placeholder="<?php _e('Example: account_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_class']; ?>" />
</div>
</div>
</div>
<?php #submit_button(); ?>
</form>
</div>
<?php
}
You can go ahead with POST Method as you used a form so upon submission use update_option to update your option values.
Reference URL :
https://codex.wordpress.org/Function_Reference/update_option
How to use update_option :
function my_option_function() {
update_option('option_value','none');
}
add_action('update_option', 'my_option_function'); ?>
For more guidance,Take a look at :
WordPress functions.php: how to apply update_option()?
Building my first plugin to Wordpress I came across Rush Frisby's Bootstrap hack, so that you can work with Bootstrap within the admin panel, without conflicting with the Wordpress admin core styles. You'll find it here: https://rushfrisby.com/using-bootstrap-in-wordpress-admin-panel/
I have implemented it in my plugin the way he explained.
You can review my code online at https://github.com/kennnielsen/wordpress_dev
There is just one problem with this part:
.bootstrap-wrapper {
#import (less) url('bootstrap.min.css');
}
The error below will disappear if I remove the (less) from above code, but then the hack is not working as expected - the bootstrap is not loaded within the bootstrap-wrapper.
First of all, I have never really worked with LESS, but I know the basic idea of LESS and how it can ease the work with your CSS.
Nevertheless, when running my plugin, and going to Settings - Custom Login I see the following error:
I have no idea what to do. I have searched the web for answers, but I can't really find a solution nor a fix for this.
Does anyone have an idea on how to solve this?
- and a brief explanation about .map files?
Thank you all in advance!
For you guys that don't want to go to Github, see below code used for the admin page.
<?php
// Meaning of abbreviations:
// clsc = Custom login shortcode
// Runs when plugin is activated
register_activation_hook( PLUGIN_MAIN_FILE, 'clsc_install');
// Create new database fields
function clsc_install() {
$clsc_options = array(
'Login_link' => 'log-in/',
'Login_string' => 'Log in',
'Login_class' => '', // Default is empty to inherit theme styles
'Logout_link' => wp_logout_url( home_url()),
'Logout_string' => 'Log out',
'Logout_class' => '', // Default is empty to inherit theme styles
'Account_link' => 'my-account/',
'Account_string' => 'My Account',
'Account_class' => '' // Default is empty to inherit theme styles
);
add_option('clsc_options_array', $clsc_options, '', 'yes');
}
// Register settings for wordpress to handle all values
function admin_init_register_setting()
{
register_setting('wp_plugin_template-group', 'clsc_options_array');
}
add_action('admin_init','admin_init_register_setting');
// Create admin option page
function add_clsc_option_page() {
add_options_page(
'Custom Login', // The text to be displayed in the title tag
'Custom Login', // The text to be used for the menu
'administrator', // The capability required to display this menu
'custom-login-shortcodes', // The unique slug name to refer to this menu
'clsc_html_page'); // The function to output the page content
}
/* Call the html code */
add_action('admin_menu', 'add_clsc_option_page');
// Enqueue admin styles and scripts
function clsc_enqueue_scripts() {
global $wpdb;
$screen = get_current_screen();
if ( $screen->id != 'settings_page_custom-login-shortcodes' ) {
return; // exit if incorrect screen id
}
wp_enqueue_style( 'custom-shortcodes-styles', plugins_url( 'admin/css/admin_styles.css', dirname(__FILE__) ) );
wp_enqueue_style( 'bootstrap', plugins_url('admin/css/bootstrap.css', dirname(__FILE__) ) );
wp_enqueue_script('admin_js_bootstrap_hack', plugins_url('admin/scripts/bootstrap-hack.js', dirname(__FILE__) ) );
wp_enqueue_script('jquery', plugins_url('admin/scripts/jquery.min.js', dirname(__FILE__) ) );
}
add_action('admin_enqueue_scripts', 'clsc_enqueue_scripts' );
function clsc_html_page()
{
if(!current_user_can('manage_options'))
{
wp_die( __('You do not have sufficient permissions to access this page.','clsc') );
}
?>
<script type="text/javascript">
var default_logout = <?php echo json_encode( wp_logout_url( home_url()) ); ?>;
$(document).ready(function(){
$("#logout-default").click(function(){
$("#logout-field").val(default_logout);
});
});
</script>
<div class="wrap">
<form method="post" action="options.php">
<?php
$options = get_option('clsc_options_array');
settings_fields('wp_plugin_template-group');
do_settings_fields('wp_plugin_template-group');
?>
<div class="bootstrap-wrapper">
<div class="row">
<div class="col-md-12">
<h1><?php _e('Custom Login Shortcode','clsc'); ?></h1>
<p><?php _e('To use for shortcode:','clsc'); ?><br/><span class="shortcode-preview">[custom_login]</span></p>
</div>
</div>
<div class="row" id="login-content">
<div class="col-md-4">
<h5><?php _e('Log in link:','clsc'); ?></h5>
<input name="clsc_options_array[Login_link]" placeholder="<?php _e('Example: log-in/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_link']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log in string:','clsc'); ?></h5>
<input name="clsc_options_array[Login_string]" placeholder="<?php _e('Example: Log in', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log in class:','clsc'); ?></h5>
<input name="clsc_options_array[Login_class]" placeholder="<?php _e('Example: login_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_class']; ?>" />
</div>
</div>
<div class="row top-buffer" id="logout-content">
<div class="col-md-4">
<h5><?php _e('Log out link:','clsc'); ?></h5>
<input id="logout-field" name="clsc_options_array[Logout_link]" placeholder="<?php _e('Example: log-out/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_link']; ?>" />
<input class="btn btn-default btn-xs" type="button" name="logout-default" id="logout-default" value="<?php _e('Use default logout link','clsc') ?>"/>
</div>
<div class="col-md-4">
<h5><?php _e('Log out string:','clsc'); ?></h5>
<input name="clsc_options_array[Logout_string]" placeholder="<?php _e('Example: Log out', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log out class:','clsc'); ?></h5>
<input name="clsc_options_array[Logout_class]" placeholder="<?php _e('Example: logout_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_class']; ?>" />
</div>
</div>
<div class="row top-buffer" id="account-content">
<div class="col-md-4">
<h5><?php _e('Account link:','clsc'); ?></h5>
<input name="clsc_options_array[Account_link]" placeholder="<?php _e('Example: my-account/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_link']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Account string:','clsc'); ?></h5>
<input name="clsc_options_array[Account_string]" placeholder="<?php _e('Example: My Account', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Account class:','clsc'); ?></h5>
<input name="clsc_options_array[Account_class]" placeholder="<?php _e('Example: account_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_class']; ?>" />
</div>
</div>
</div>
<?php submit_button( __('Save Changes', 'clsc') ); ?>
</form>
</div>
<?php
}
?>
Suggestion :
It's not a good idea to use minified CSS for developmental purposes also it's hard to debug when there are errors in your CSS Code & more likely sometimes gives parse errors due the fact that the whole code is converted into one line which seems to be not ending at all.
Problem :
Inability of LESS to compile a minified version of Bootstrap is a known problem: http://github.com/less/less.js/issues/2207.
The parser may fail at certain non-CSS-conformant browser-specific hacks (the error message may vary depending on the Bootstrap and/or Less versions). The usual workaround is just to compile non-minified version (note that compiling a minified version does not make too much sense since the result of compilation is not minified CSS anyway)
#Credit Goes To seven-phases-max For The Reference URL
Solution :
Well, The problem seems to be with your Minified bootstrap.min.css file,Try to use the unminified version bootstrap.css and you will have no problem.
A friend has asked me to look at a website they had built (long story short they fell out so site didnt get finished). There is a search bar on the left hand side with 3 different search categories
Ive found the code for it in form.mini.phtml
<div id="search1">
<h3>
SEARCH >>>
</h3>
<form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
<div id="label_area">
<div id="label_area">
</div>
<input type="text" name="label" id="label" value="Label >>>" onclick="if(this.value!='Label >>>'){ } else { this.value =''; } "size="15" class="text2">
</div>
<div id="label_area">
<div id="label_area">
</div>
<input type="text" name="artist" id="artist" value="Artists >>>" onclick="if(this.value!='Artists >>>'){ } else { this.value =''; } "size="15" class="text2">
</div>
<div id="label_area">
<div id="label_area">
</div>
<input id="search" type="text" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>" class="text2" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>" /></div>
<div id="label_area"> <input type="image" src="<?php echo $this->getSkinUrl('images/go.jpg')?>" />
</div>
</form>
</div>
<!--<form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
<div class="form-search">
<label for="search"><?php echo $this->__('Search:') ?></label>
<input id="search" type="text" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>" class="input-text" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>" />
<button type="submit" title="<?php echo $this->__('Search') ?>" class="button"><span><span><?php echo $this->__('Search') ?></span></span> </button>-->
<div id="search_autocomplete" class="search-autocomplete"></div>
<script type="text/javascript">
//<![CDATA[
var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Keywords>>>>>>>') ?>');
searchForm.initAutocomplete('<?php echo $catalogSearchHelper->getSuggestUrl() ?>', 'search_autocomplete');
//]]>
</script>
<!-- </div>
</form>-->
It looks like the developer has hashed this together, My question is, how do go about getting the label/artist fields working? sorry for the clumsiness, Im a novice with PhP, Ive tried a couple of approaches with no joy, thank you very much in advance :)
I trying to make a feature, where the user recieves a message saying "Your changes have been saved" after the user has pressed "save changes". When the form is being submittet the page is just refreshed and not redirected to any other page.
I have tried several things but nothing seems to work. I am good at HTML but not PHP. I would love if any of you could help me out!
My code for my profile template is the folowing:
<div class="user-image">
<div class="bordered-image thick-border">
<?php echo get_avatar(ThemexUser::$data['user']['ID'], 200); ?>
</div>
<div class="user-image-uploader">
<form action="<?php echo themex_url(); ?>" enctype="multipart/form-data" method="POST">
<label for="avatar" class="button"><span class="button-icon upload"></span><?php _e('Skift billede','academy'); ?></label>
<input type="file" class="shifted" id="avatar" name="avatar" />
<input type="hidden" name="user_action" value="update_avatar" />
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce(THEMEX_PREFIX.'nonce'); ?>" />
</form>
</div>
</div>
<div class="user-description">
<form action="<?php echo themex_url(); ?>" class="formatted-form" method="POST">
<div class="message">
<?php ThemexInterface::renderMessages(); ?>
</div>
<div class="sixcol column">
<div class="field-wrapper">
<input type="text" name="first_name" size="30" value="<?php echo ThemexUser::$data['user']['profile']['first_name']; ?>" placeholder="<?php _e('Fornavn','academy'); ?>" />
</div>
</div>
<div class="sixcol column last">
<div class="field-wrapper">
<input type="text" name="last_name" size="30" value="<?php echo ThemexUser::$data['user']['profile']['last_name']; ?>" placeholder="<?php _e('Efternavn','academy'); ?>" />
</div>
</div>
<div class="clear"></div>
<!-- ADRESSE -->
<?php if(!ThemexCore::checkOption('profile_signature')) { ?>
<div class="field-wrapper">
<input type="text" name="signature" value="<?php echo ThemexUser::$data['user']['profile']['signature']; ?>" placeholder="<?php _e('Adresse','academy'); ?>" />
</div>
<?php } ?>
<div class="user-fields">
<?php ThemexForm::renderData('profile', array(), ThemexUser::$data['user']['profile']); ?>
</div>
<?php } ?>
<span class="button-icon save"> </span><?php _e('Gem ændringer','academy'); ?>
<input type="hidden" name="user_action" value="update_profile" />
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce(THEMEX_PREFIX.'nonce'); ?>" />
</form>
</div>
you are submitting to another url. So you can add something like the below to your functions file to display a message when the url is appended with msg. (you can account for multiple messages using the switch below, look it up) also you will need to add `?msg=yourmessagevariable' to your form action.
add_action('wp_print_scripts', 'notifcation', 100);
function notifcation () {
if($_GET['msg']) {
$message= sanitize_text_field($_GET['msg']);
switch($message) {
case 'reg-business':
$notehead= 'Please register first';
$msg= 'Please register your business before continuing';
break;
case 'nowvalid':
$notehead= "Congratulations";
$msg='You have successfully connected ';
break;
case 'Completed':
$notehead= 'Edited';
$msg='You have successfully edited your advert';
break;
}
?>
<section id="notification" class="notif notif-notice">
<h6 class="notif-title"><?php echo $notehead;?></h6>
<p><?php echo $msg; ?></p>
<div class="notif-controls">
Close
</div>
</section>
<script type="text/javascript">
jQuery(document).ready(function() {
setTimeout(function(){
jQuery('#notification').css('display', 'none');
},3000)
});
jQuery('.notif-close').click(function(e){
e.preventDefault();
jQuery(this).parent().parent().css('display', 'none');
})
</script>
<?php
}
}