File: //home/globfdxw/diasporameetsafrica.com/wp-content/themes/DA10/templates/tpl-add.php
<?php
/*
Template Name: [PAGE - ADD LISTING]
* Theme: PREMIUMPRESS CORE FRAMEWORK FILE
* Url: www.premiumpress.com
* Author: Mark Fail
*
* THIS FILE WILL BE UPDATED WITH EVERY UPDATE
* IF YOU WANT TO MODIFY THIS FILE, CREATE A CHILD THEME
*
* http://codex.wordpress.org/Child_Themes
*/
if (!defined('THEME_VERSION')) { header('HTTP/1.0 403 Forbidden'); exit; }
global $CORE, $userdata, $CORE;
$GLOBALS['flag-add'] = 1;
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
if(_ppt(array('captcha','enable')) == 1 && _ppt('captcha','sitekey') != ""){
wp_enqueue_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js' );
}
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
if(isset($_GET['eid']) && is_numeric($_GET['eid']) && !current_user_can('administrator') && !$CORE->PACKAGE("canedit", $_GET['eid'])){
header("location:"._ppt(array('links','myaccount')));
die();
}
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
if($GLOBALS['accounttype']['key'] == "visitor" && $GLOBALS['accounttype']['can_add'] == "0"){
$CORE->Authorize();
}
// MEMBERSHIP CHECK
if(_ppt(array('mem','enable')) == "1" && _ppt(array('mem','membership_required_listing')) == "1"){
if($userdata->ID){
if(isset($_GET['eid']) && get_post_field ('post_author', $_GET['eid']) == $userdata->ID ) {
// ALLOW LISTING OWNERS TO EDIT THEIR OWN LISTINGS
}else{
$mymem = $CORE->USER("get_user_membership", $userdata->ID);
if(!is_array($mymem)){
header("location: "._ppt(array('links','myaccount'))."?tab=membership");
exit();
}
if(is_array($mymem) && isset($mymem['expired']) && $mymem['expired'] == 0 ){
// CHECK IF THE MEMBERSHIP ONLY ALLOWS X NUMBER OF LISTINGS
$included = _ppt('mem'.$mymem['key'].'_listings_count');
if(is_numeric($included) && $included > 0){
$left = $CORE->USER("get_user_free_membership_addon", array("listings", $userdata->ID));
if($left < 1){
header("location: "._ppt(array('links','myaccount'))."?tab=membership");
exit();
}
}
}
}
}else{
header("location: "._ppt(array('links','memberships')));
exit();
}
}
// photverify
if(_ppt(array('register','photoverify')) == '1' && $userdata->ID ){
if($CORE->USER("get_verified_photo", $userdata->ID) == "0" ){
header("location: "._ppt(array('links','myaccount'))."?tab=membership");
exit();
}
}
get_header();
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
$canContinue = 1;
if( !isset($_GET['eid']) && isset($GLOBALS['accounttype']) && $GLOBALS['accounttype']['can_add'] == "0" && !$CORE->USER("membership_hasaccess", "listings_multiple") ){
$canContinue = 0;
_ppt_template( 'forms/add-listing-noaccess' );
}
if( !isset($_GET['eid']) && isset($GLOBALS['accounttype']) && $GLOBALS['accounttype']['can_add_multiple'] == "0" && $userdata->ID ){
if( ( in_array(THEME_KEY, array("da")) && $CORE->USER("count_listings_all", $userdata->ID) > 0 ) || ( $CORE->USER("count_listings_all", $userdata->ID) > 0 && !$CORE->USER("membership_hasaccess", "listings_multiple") )){
$canContinue = 0;
_ppt_template( 'forms/add-listing-noaccess-multiple' );
}
}
if($canContinue){
_ppt_template('forms/add-listing' );
}
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
get_footer(); ?>