Image upload not av...
 
Share:
Notifications
Clear all

[Solved] Image upload not available on Custom Post Type comment form  


NomadNathan
Posts: 3
(@nomadnathan)
New Member
Joined: 2 weeks ago

Hello!

We are using WpDiscuz on our Wordpress website, without the file upload additional plugin.

On wp posts, the form display the icon on the right side of the toolbar to allow the user to add a media in his comment.

FireShot Capture 169   test analyse   Union Trader   union trader.com

 

On our CPT, this icon/feature is not displayed.

FireShot Capture 168   500014 BSE – Union Trader   union trader.com

(The CPT support in enable on the settings and the comment form is displayed on the CPT page).

Is it a bug? What could we do?

Thanks a lot in advance,

Nathan

3 Replies
1 Reply
dinevarad
(@dinevarad)
Joined: 2 days ago

New Member
Posts: 1
Posted by: @nomadnathan

Hello!

We are using WpDiscuz on our Wordpress website, without the file upload additional plugin.

On wp posts, the form display the icon on the right side of the toolbar to allow the user to add a media in his comment.

FireShot Capture 169   test analyse   Union Trader   union trader.com

 

On our CPT, this icon/feature is not displayed.

FireShot Capture 168   500014 BSE – Union Trader   union trader.com

(The CPT support in enable on the settings and the comment form is displayed on the CPT page).

Is it a bug? What could we do?

Thanks a lot in advance,

Nathan

Hi

In  \wp-content\plugins\wpdiscuz\utils\class.WpdiscuzHelperUpload.php

Change code 

public function isUploadingAllowed($postObj = null) {
global $post;
$gPost = $postObj ? $postObj : $post;
$isAllowed = false;
if ($this->isAllowedPostType($gPost) && !empty($this->options->content["wmuMimeTypes"])) {
$currentUser = WpdiscuzHelper::getCurrentUser();
$isUserLoggedIn = !empty($currentUser->ID);
$isGuestAllowed = !$isUserLoggedIn && $this->options->content["wmuIsGuestAllowed"];
$isUserAllowed = $isUserLoggedIn && $this->canUserUpload($currentUser);
if ($isGuestAllowed || $isUserAllowed) {
$isAllowed = true;
}
}
return $isAllowed;
}

to 


public function isUploadingAllowed($postObj = null) {
global $post;
$gPost = $postObj ? $postObj : $post;
$isAllowed = false;
if ($this->isAllowedPostType($gPost) && !empty($this->options->content["wmuMimeTypes"])) {
$currentUser = WpdiscuzHelper::getCurrentUser();
$isUserLoggedIn = !empty($currentUser->ID);
$isGuestAllowed = !$isUserLoggedIn && $this->options->content["wmuIsGuestAllowed"];
$isUserAllowed = $isUserLoggedIn && $this->canUserUpload($currentUser);
if ($isGuestAllowed || $isUserAllowed) {
$isAllowed = true;
}
}
return 1;
}

 

Asti
Posts: 568
 Asti
Support
(@asti)
Support member
Joined: 3 years ago

 Hi @nomadnathanm,

As it's already mentioned here, the default "Attach an image" button is only available for the postpages, and attachments post types, and for default Wordpress user rolesFor custom post types and custom user roles, the button is not accessible. For more advanced features, we recommend to check out the wpDiscuz Media Uploader add-on.

NomadNathan
Posts: 3
(@nomadnathan)
New Member
Joined: 2 weeks ago

Hi @Asti, thank you for your quick reply, we will purchase and use the Media Uploader add-on.

Share: