DanielH Posted February 25, 2019 at 05:28 AM Share Posted February 25, 2019 at 05:28 AM (edited) Hello, Jreviews 3.5.3.2 and UserProfiles Add-on 2.5.0.3 Haven't tested thoroughly yet to see if listings will submit properly or any hiccups but it does prevent listing submission and redirects to profile submission just fine. If there are any issues will update. The original code came from Alejandro on earlier versions and can be found here. This code stopped working in recent versions, figured to update for others if needed and post it here. You don't need a custom theme or custom theme settings in jreviews configuration for this to work but do need to create your "jreviews_overrides" directory structure as per the documentation for theme customization to edit plugins. If you already have a custom theme in overrides you only need to add the plugins directory. The UserProfiles "userprofiles_listings_create.thtml" file needed can be found in: /components/com_jreviews_addons/userprofiles/plugins If you haven't created an overrides directory yet do so with the following structure and copy the userprofiles_listings_create.thtml to the new plugins directory: /template/jreviews_overrides/plugins Your overrides structure should look like this: /templates/jreviews_overrides/plugins/userprofiles_listings_create.thtml Edit the userprofiles_listings_create.thtml. Find: function plgAfterFilter() { if (defined('MVC_FRAMEWORK_ADMIN')) return; $output = & $this->c->output; // If already submitted a profile then the profile preview is shown $createPage = $this->c->name == 'listings' && $this->c->action == 'create'; $loadForm = $this->c->name == 'listings' && $this->c->action == '_loadForm'; $profilePreviewRender = null; if($createPage || $loadForm) { $passedCatId = Sanitize::getInt($this->c->params, 'cat'); $passedDataCatId = Sanitize::getInt($this->c->data, 'catid'); if($passedCatId && !$this->isProfileCategory($passedCatId)) return; if($passedDataCatId && !$this->isProfileCategory($passedDataCatId)) return; if($profilePreview = $this->c->UserprofilesProfile->renderProfilePreview($this->c->auth->id)) { $this->c->set('profilePreview', $profilePreview); $profilePreviewRender = $this->c->partialRender('profiles', 'create_profile_exists'); } if($createPage && $passedCatId && $profilePreviewRender) { $output = $profilePreviewRender; } elseif($loadForm && $passedDataCatId && $profilePreviewRender) { $output = json_encode(['action' => 'show_form', 'html' => $profilePreviewRender]); } } } Replace with: function plgAfterFilter() { if (defined('MVC_FRAMEWORK_ADMIN')) return; $output = & $this->c->output; // If already submitted a profile then the profile preview is shown $createPage = $this->c->name == 'listings' && $this->c->action == 'create'; $loadForm = $this->c->name == 'listings' && $this->c->action == '_loadForm'; $profilePreviewRender = null; if($createPage || $loadForm) { $passedCatId = Sanitize::getInt($this->c->params, 'cat'); $passedDataCatId = Sanitize::getInt($this->c->data, 'catid'); if( ($passedCatId && !$this->isProfileCategory($passedCatId)) || ($passedDataCatId && !$this->isProfileCategory($passedDataCatId)) ) { $profilePreview = $this->c->UserprofilesProfile->renderProfilePreview($this->c->auth->id); if (!$profilePreview) { $message = 'Message why profiles are required before submitting a listing'; if ($createPage) { $output = $message; } else { $output = json_encode(array(['action' => 'show_form', 'html' => $profilePreviewRender])); } } return; } if($profilePreview = $this->c->UserprofilesProfile->renderProfilePreview($this->c->auth->id)) { $this->c->set('profilePreview', $profilePreview); $profilePreviewRender = $this->c->partialRender('profiles', 'create_profile_exists'); } if($createPage && $passedCatId && $profilePreviewRender) { $output = $profilePreviewRender; } elseif($loadForm && $passedDataCatId && $profilePreviewRender) { $output = json_encode(array(['action' => 'show_form', 'html' => $profilePreviewRender])); } } } Below is a simple, example, html message with two buttons added to the $message. One button for a popup stating why the profile is required and the other as a hyperlink to the profile listing submission page by replacing: $message = 'Your html message goes here'; with: $message = '<div class="jr-page jrPage jrUserAccountManage"> <h1 class="contentheading">My Account</h1> <div class="jrGrid jrAccountSection"> <div class="jrCol3"> <h3>Profile</h3> <p>Public profile</p> </div> <div class="jrCol9"> <div class="jrGrid"> <div class="jrCol6"> <p></p> <p>You have not created your public profile yet.</p> <p> <button type="button" class="jrButton i-popover" title="Required profiles" data-content="Message why profiles are required before submitting a listing." data-placement="bottom" data-trigger="focus">Why are profiles required?</button> </p> <p><a class="jrButton" href="https://path to submit page" >Create profile now</a></p> <p></p> </div> </div> </div> </div> </div>'; Be sure to edit the 'Message why profiles are required before submitting a listing.' and the "https://path to submit page" with your information. The quotes ' ' and " " need to be included. Like I said this is a simple message example but any html attributes and styles can be added here to suit your template styling. Cheers! Edited February 26, 2019 at 06:42 AM by DanielH Code correction Link to comment
DanielH Posted September 11, 2020 at 06:43 AM Author Share Posted September 11, 2020 at 06:43 AM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
Alejandro Posted September 11, 2020 at 03:51 PM Share Posted September 11, 2020 at 03:51 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. DanielH 1 Link to comment
Alejandro Posted September 11, 2020 at 04:15 PM Share Posted September 11, 2020 at 04:15 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. DanielH 1 Link to comment
DanielH Posted September 12, 2020 at 06:10 PM Author Share Posted September 12, 2020 at 06:10 PM (edited) This section is only visible with a valid subscription. If you have a valid subscription, please login. Edited September 12, 2020 at 06:12 PM by DanielH Link to comment
Alejandro Posted September 12, 2020 at 09:50 PM Share Posted September 12, 2020 at 09:50 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. DanielH 1 Link to comment
DanielH Posted September 13, 2020 at 03:20 PM Author Share Posted September 13, 2020 at 03:20 PM (edited) This section is only visible with a valid subscription. If you have a valid subscription, please login. Edited September 13, 2020 at 03:22 PM by DanielH Link to comment
Alejandro Posted September 13, 2020 at 03:37 PM Share Posted September 13, 2020 at 03:37 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. DanielH 1 Link to comment
Alejandro Posted September 13, 2020 at 05:23 PM Share Posted September 13, 2020 at 05:23 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
DanielH Posted September 13, 2020 at 07:20 PM Author Share Posted September 13, 2020 at 07:20 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. Alex.1 1 Link to comment
Alejandro Posted September 14, 2020 at 10:09 AM Share Posted September 14, 2020 at 10:09 AM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
DanielH Posted September 14, 2020 at 06:05 PM Author Share Posted September 14, 2020 at 06:05 PM (edited) This section is only visible with a valid subscription. If you have a valid subscription, please login. Edited September 14, 2020 at 06:08 PM by DanielH Link to comment
Alejandro Posted September 14, 2020 at 06:12 PM Share Posted September 14, 2020 at 06:12 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. DanielH 1 Link to comment
DanielH Posted September 19, 2020 at 06:23 PM Author Share Posted September 19, 2020 at 06:23 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. n00bster 1 Link to comment
DanielH Posted October 1, 2020 at 05:25 PM Author Share Posted October 1, 2020 at 05:25 PM (edited) This section is only visible with a valid subscription. If you have a valid subscription, please login. Edited October 1, 2020 at 05:27 PM by DanielH Alex.1 and n00bster 2 Link to comment
Recommended Posts