R
R
RushV2020-09-10 17:16:04
MODX
RushV, 2020-09-10 17:16:04

Removal code for a resource?

Hello!
Help implement the code to unpublish the miniShop2 resource when the button is clicked.
Can you change this code?

<?php
$res = $modx->getObject('modResource',$id);
$createdby = $res->get('createdby');

$user = $modx->user->getOne('Profile');
$profile = $user->get('id');

if($createdby == $profile){
    if($_GET['user'] == $profile ) {
        $unid = $_GET['id'];
        $resource = $modx->getObject('modResource', $unid );
        $resource->set('published',1);
        $resource->save();
    }
}

Thank you in advance for your help!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question