VizionDev Posted August 8, 2015 Share Posted August 8, 2015 Hey, support/guides/_/ips-community-suite-apps/ip-cont/raw-php-in-ipcontent-r282 This page suggests that when using a Manual PHP block, you have access to memberData. however: var_dump($this->memberData) // Produces a "Fatal Error" var_dump($this) // Returns NULL So I can only assume this documentation is out of date, Long story short, I'm also using IP.Nexus and need to check if a product has been purchased Can anybody point me in the right direction or maybe to some documentation I missed Link to comment Share on other sites More sharing options...
Morrigan Posted August 8, 2015 Share Posted August 8, 2015 I assume you are using IPS4?You load via: \IPS\Member::load Link to comment Share on other sites More sharing options...
VizionDev Posted August 8, 2015 Author Share Posted August 8, 2015 I assume you are using IPS4?You load via: \IPS\Member::load Hey thanks for your response.Yes I am using IPv4Could you by chance please elaborate on what you mean, or point me to the docs because I couldn't find much Link to comment Share on other sites More sharing options...
Marcher Technologies Posted August 8, 2015 Share Posted August 8, 2015 $this->memberData['member_id']//3.x \IPS\Member::loggedIn()->member_id//4.xAssuming that you wish to work with the logged in user as $this->memberData was, \IPS\Member::loggedIn() returns an object of \IPS\Member for the currently logged in user, and the properties of said object will hold the data, instead of it being an array. Beyond that it's much the same. Link to comment Share on other sites More sharing options...
VizionDev Posted August 8, 2015 Author Share Posted August 8, 2015 $this->memberData['member_id']//3.x \IPS\Member::loggedIn()->member_id//4.x Assuming that you wish to work with the logged in user as $this->memberData was, \IPS\Member::loggedIn() returns an object of \IPS\Member for the currently logged in user, and the properties of said object will hold the data, instead of it being an array. Beyond that it's much the same. Ahh clarity. Thank you very much mate Link to comment Share on other sites More sharing options...
VizionDev Posted August 8, 2015 Author Share Posted August 8, 2015 How would I access IP.Nexus bought items of a user?Sorry to ask, all documentation seems outdated for 4.x(oh because there is no developer docs for 4.x)https://www.invisionpower.com/support/guides/_/advanced-and-developers/4-0-developer-documentation/ Link to comment Share on other sites More sharing options...
VizionDev Posted August 8, 2015 Author Share Posted August 8, 2015 bump Link to comment Share on other sites More sharing options...
Stuart Silvester Posted August 8, 2015 Share Posted August 8, 2015 IPS4 docs are actually on this site, not the main sitehttps://community.invisionpower.com/4docs/ What kind of information is it you want to access? Link to comment Share on other sites More sharing options...
Marcher Technologies Posted August 8, 2015 Share Posted August 8, 2015 Commerce license isn't active, so I can't go digging through the code for your answer, or I would have. My apologies. Please do clarify so others may be able to help. Link to comment Share on other sites More sharing options...
VizionDev Posted August 9, 2015 Author Share Posted August 9, 2015 IPS4 docs are actually on this site, not the main site https://community.invisionpower.com/4docs/ What kind of information is it you want to access? Nothing for developers though, all I needed to access was the product id's that the loggedIn user had purchased. Commerce license isn't active, so I can't go digging through the code for your answer, or I would have. My apologies. Please do clarify so others may be able to help. Thanks for the thought For the record I just accessed the database directly given I was unable to find anything for it anywhere. I created a block with the following: $IPBSql = new MySQLi('localhost', 'user', 'pass', 'ipb_db'); $MainSql = new MySQLi('localhost', 'user', 'pass', 'my_db'); $MemberID = \IPS\Member::loggedIn()->member_id; $TimeNow = time(); $Package = false; $st = $IPBSql->prepare("SELECT ps_name,ps_item_id FROM nexus_purchases WHERE ps_expire > ? AND ps_member = ?"); $st->bind_param('ii', $TimeNow, $MemberID); $st->bind_result($Name, $ItemID); $st->execute(); if ($st->fetch()) { $st->close(); switch ($ItemID) { case 7: { $Package = "Bronze"; $st = $MainSql->query("SELECT * FROM tblProperties WHERE UNIX_TIMESTAMP() > (Added + (86400*2)) ORDER BY PropertyID DESC"); $Data = array(); while ($tmp = $st->fetch_array(MYSQLI_ASSOC)) $Data[] = $tmp; } break; case 8: { $Package = "Silver"; $st = $MainSql->query("SELECT * FROM tblProperties WHERE UNIX_TIMESTAMP() > (Added + 86400) ORDER BY PropertyID DESC"); $Data = array(); while ($tmp = $st->fetch_array(MYSQLI_ASSOC)) $Data[] = $tmp; } break; case 9: { $Package = "Gold"; $st = $MainSql->query("SELECT * FROM tblProperties ORDER BY PropertyID DESC"); $Data = array(); while ($tmp = $st->fetch_array(MYSQLI_ASSOC)) $Data[] = $tmp; } break; default: { $Package = false; $st = $MainSql->query("SELECT * FROM tblProperties WHERE UNIX_TIMESTAMP() > (Added + (86400*7)) ORDER BY PropertyID DESC"); $Data = array(); while ($tmp = $st->fetch_array(MYSQLI_ASSOC)) $Data[] = $tmp; } break; } } else { $st->close(); } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.