deprecated in 1.8: Plungin Market 1.9 in elgg 1.9

deprecated in 1.8: isloggedin() is deprecated user_is_logged_in()

deprecated in 1.8: elggentity::getowner deprecated for elggentity::getownerguid

====================================================================

 

I have elgg version 1.9 and installed slyhne's friend plugin market (Congratulations). Then testing plugin when deleting the item appeared to red card with two warnings:

deprecated in 1.8: isloggedin () is deprecated user_is_logged_in () Deprecated in 1.8: elggentity :: getowner deprecated for elggentity :: getownerguid I got this warning by disabling engine / lib / deprecated-1.8.php respectively on line 3060 and engine / classes / elggentity.php line 1241. I do not know what problera may have disabling these lines but solved problem. If someone goes through something similar is the tip.

  • WRONG!

    If you don't know what you are doing, please don't advice others to do it in a wrong way, too.

    Commenting out code just because it gives you a warning or error is not the right way. Find out what's wrong and fix the problem is the right way.

    In case of deprecation warnings provided by Elgg, the warning already gives you the advice what you need to do to fix the problem. The warnings tell you that there's a new function in the Elgg API that replaces an old function. For a certain time the old function is still working but it's adviced to use the new function instead for the plugin to work also on future versions of Elgg.

    isloggedin()   ---> replace with elgg_is_user_logged_in(),

    getOwner() entity method --> replace with getOwnerGUID().

  •   Sorry if I advised wrong, I am beginner .. I did not intend .. I found the comments that this would be a solution for elgg because it has deprecated warning that they are "unnecessary" or "unnecessary". But thank you for the response and help. So that replaces and not right.

     public function getOwnerGUID() {
            return (int)$this->owner_guid;
        }

        /**
         * Return the guid of the entity's owner.
         *
         * @return int The owner GUID
         * @deprecated 1.8 Use getOwnerGUID()
         */
        public function getOwner() {   HERE REPLACE
        //    elgg_deprecated_notice("ElggEntity::getOwner deprecated for ElggEntity::getOwnerGUID", 1.8);
            return $this->getOwnerGUID();
        }

    Where to replace? I changed the name of the function but it did not work. can you help me?

     
  • Do not modify the code in the deprecated-X.Y.php files. These files provide the backward compatibility for plugins that do not use the newly added functions yet. Restore the orignal files again.

    What you need to do is to fix the problem in the code of the plugins that still use the old functions (as the deprecation warnings tell you). If you change the code of the plugins, i.e. replace the deprecated functions with the new functions suggested, there won't be any warnings anymore.

  • Thank you iionly. I'll do that. You're more experienced we just have to learn.