{"id":6885,"date":"2014-05-08T16:33:21","date_gmt":"2014-05-08T16:33:21","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/08\/how-to-convert-joomlaacl-from-joomla-1-5-to-joomla-2-5-version-collection-of-common-programming-errors\/"},"modified":"2014-05-08T16:33:21","modified_gmt":"2014-05-08T16:33:21","slug":"how-to-convert-joomlaacl-from-joomla-1-5-to-joomla-2-5-version-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/08\/how-to-convert-joomlaacl-from-joomla-1-5-to-joomla-2-5-version-collection-of-common-programming-errors\/","title":{"rendered":"How to convert joomla(ACL) from joomla 1.5 to joomla 2.5 version-Collection of common programming errors"},"content":{"rendered":"<p>I have a function in joomla 1.5<\/p>\n<pre><code>function saveuser($row){\n    $db =&amp; JFactory::getDBO();\n    $instance = new JUser();\n    jimport('joomla.application.component.helper');\n    $config   = &amp;JComponentHelper::getParams('com_users');\n    if(!isset($row['usertype']))\n    $row['usertype'] = $config-&gt;get( 'new_usertype', 'Registered' );\n\n    $acl =&amp; JFactory::getACL();\n    if(!$row['gid'])\n    $row['gid'] = $acl-&gt;get_group_id( '', $usertype);\n\n    $instance-&gt;set( 'id'            , $row['id'] );\n    $instance-&gt;set( 'name'          , $row['name'] );\n    $instance-&gt;set( 'username'      , $row['username'] );\n    $instance-&gt;set( 'password'      , $row['password'] );\n    $instance-&gt;set( 'email'         , $row['email'] );\n    $instance-&gt;set( 'gid'           , $row['gid']);\n    $instance-&gt;set( 'usertype'      , $row['usertype'] );\n    unset($instance-&gt;password_clear);\n    unset($instance-&gt;guest);\n    unset($instance-&gt;aid);\n    $ret = $db-&gt;insertObject( '#__users', $instance, 'id' );\n    if(!$ret){\n        return false;\n    }\n    $acl-&gt;add_object( 'users', $row['username'], $row['id'], null, null, 'ARO' );\n    $acl-&gt;add_group_object( $row['gid'], 'users', $row['id'], 'ARO' );\n    return true;\n}\n<\/code><\/pre>\n<p>But when run as joomla 2.5 is error is:<\/p>\n<pre><code>Fatal error: Call to undefined method JAccess::get_group_id() in ... on line ...\nFatal error: Call to undefined method JAccess::add_object() in ... on line ...\nFatal error: Call to undefined method JAccess::add_group_object() ... on line ...\n\nHow to fix this function to joomla 2.5, How to ideas ?\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I have a function in joomla 1.5 function saveuser($row){ $db =&amp; JFactory::getDBO(); $instance = new JUser(); jimport(&#8216;joomla.application.component.helper&#8217;); $config = &amp;JComponentHelper::getParams(&#8216;com_users&#8217;); if(!isset($row[&#8216;usertype&#8217;])) $row[&#8216;usertype&#8217;] = $config-&gt;get( &#8216;new_usertype&#8217;, &#8216;Registered&#8217; ); $acl =&amp; JFactory::getACL(); if(!$row[&#8216;gid&#8217;]) $row[&#8216;gid&#8217;] = $acl-&gt;get_group_id( &#8221;, $usertype); $instance-&gt;set( &#8216;id&#8217; , $row[&#8216;id&#8217;] ); $instance-&gt;set( &#8216;name&#8217; , $row[&#8216;name&#8217;] ); $instance-&gt;set( &#8216;username&#8217; , $row[&#8216;username&#8217;] ); $instance-&gt;set( &#8216;password&#8217; , $row[&#8216;password&#8217;] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6885","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6885","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6885"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6885\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}