Painbaker
New Member
AMS Premium
CAS Premium
IMS Premium
GS Premium
KBS Premium
LD Premium
RMS Premium
SC Premium
UBS Premium
TS Premium
Pick'em
Sportsbook
		XenForo Version String: XenForo 2.2.13
Addon Version String: CAS 2.2.29
Stack Trace:-
New ads has no default user_id value set for template variable
	
	
	
		
This causes some permission check conditions to not work properly:
	
	
	
		
				
			Addon Version String: CAS 2.2.29
Stack Trace:-
New ads has no default user_id value set for template variable
		PHP:
	
	public function actionAdd(ParameterBag $params)
{
       ...
if ($this->isPost())
        {
            ...
        }
        else
        {
            $ad = $category->getNewAd();
            $ad->title = $draft->title ?: '';
            $ad->og_title = $draft->og_title ?: '';
            $ad->meta_title = $draft->meta_title ?: '';
            $ad->prefix_id = $draft->prefix_id ?: 0;
            $ad->description = $draft->description ?: '';
            $ad->meta_description = $draft->meta_description ?: '';
            $ad->message = $draft->message ?: '';
            $ad->external_purchase_url = $draft->external_purchase_url ?: '';
            $ad->accept_offers = $draft->accept_offers ?: 0;
            $ad->amount_available = $draft->amount_available ?: 0;
            $ad->amount_sold = $draft->amount_sold ?: 0;
          
            ...
          
            $viewParams = [
                'category' => $category,
                'ad' => $ad,
                'prefixes' => $category->getUsablePrefixes(),
                'attachmentData' => $attachmentData,
            ];
          
            return $this->view('XenAddons\CAS:Category\PostAd', 'xa_cas_category_post_ad', $viewParams);
        }
}This causes some permission check conditions to not work properly:
		PHP:
	
	public function canSetExternalPurchaseUrl(&$error = null)
    {
        ...
        return (
            $visitor->user_id == $this->user_id // <-- for new ads this value is always null
            && $this->hasPermission('editOwn')
            && $this->hasPermission('setExternalPurchaseUrlOwn')
        );
    }
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
	 
 
		
 
 
		