mahmoudimus

Send private message

You must be logged in to send a private message.

Activity

  • mahmoudimus replied on the discussion topic Autopopulating fields from a previous registration form in the group Form and related plugins
    Hey all, So I really appreciate this plugin, but I want to know how I can pre-populate fields? I haven't really looked at the code yet, I was thinking someone can save me some time;) If not, I'll post my results here. Thanks in advance, Mahmoud...
    • form_set_data($entity, $data)

      This function takes an array data, with the internal_data strings as array access keys, which has instantiated stdClass() objects per field definition (internal_data strings). The attribute "value" stores the value respective to it's internal data string.

      $entity is the ElggEntity that allows metadata, for flexprofile, it's the ElggUser.

    • Looks like form_set_data() and flexprofile_set_data() are exactly the same function.

      Looks like the metadata is being set using create_metadata(), so you can technically get the $user object and just use the regular metadata methods to set and retrieve values.

      For example, if a form field internal_id is "flex_plugin" then $user->flex_plugin = "somevalue"; or echo $user->flex_plugin; would work

       

    • Yep, just confirmed it

      $user->setMetaData(%internal_name%, %value%);
      $user->getMetaData(%internal_name%);

      works fine.

      I think it would be wise, however, to use form_set_data() to control the access. You can always use access_id to override it.

      Hope this helps someone:)

  • mahmoudimus replied on the discussion topic Autopopulating fields from a previous registration form in the group Form and related plugins
    Hey all, So I really appreciate this plugin, but I want to know how I can pre-populate fields? I haven't really looked at the code yet, I was thinking someone can save me some time;) If not, I'll post my results here. Thanks in advance, Mahmoud...
    • form_set_data($entity, $data)

      This function takes an array data, with the internal_data strings as array access keys, which has instantiated stdClass() objects per field definition (internal_data strings). The attribute "value" stores the value respective to it's internal data string.

      $entity is the ElggEntity that allows metadata, for flexprofile, it's the ElggUser.

    • Looks like form_set_data() and flexprofile_set_data() are exactly the same function.

      Looks like the metadata is being set using create_metadata(), so you can technically get the $user object and just use the regular metadata methods to set and retrieve values.

      For example, if a form field internal_id is "flex_plugin" then $user->flex_plugin = "somevalue"; or echo $user->flex_plugin; would work

       

    • Yep, just confirmed it

      $user->setMetaData(%internal_name%, %value%);
      $user->getMetaData(%internal_name%);

      works fine.

      I think it would be wise, however, to use form_set_data() to control the access. You can always use access_id to override it.

      Hope this helps someone:)

  • mahmoudimus replied on the discussion topic Autopopulating fields from a previous registration form in the group Form and related plugins
    Hey all, So I really appreciate this plugin, but I want to know how I can pre-populate fields? I haven't really looked at the code yet, I was thinking someone can save me some time;) If not, I'll post my results here. Thanks in advance, Mahmoud...
    • form_set_data($entity, $data)

      This function takes an array data, with the internal_data strings as array access keys, which has instantiated stdClass() objects per field definition (internal_data strings). The attribute "value" stores the value respective to it's internal data string.

      $entity is the ElggEntity that allows metadata, for flexprofile, it's the ElggUser.

    • Looks like form_set_data() and flexprofile_set_data() are exactly the same function.

      Looks like the metadata is being set using create_metadata(), so you can technically get the $user object and just use the regular metadata methods to set and retrieve values.

      For example, if a form field internal_id is "flex_plugin" then $user->flex_plugin = "somevalue"; or echo $user->flex_plugin; would work

       

    • Yep, just confirmed it

      $user->setMetaData(%internal_name%, %value%);
      $user->getMetaData(%internal_name%);

      works fine.

      I think it would be wise, however, to use form_set_data() to control the access. You can always use access_id to override it.

      Hope this helps someone:)

  • mahmoudimus replied on the discussion topic Autopopulating fields from a previous registration form in the group Form and related plugins
    Hey all, So I really appreciate this plugin, but I want to know how I can pre-populate fields? I haven't really looked at the code yet, I was thinking someone can save me some time;) If not, I'll post my results here. Thanks in advance, Mahmoud...
    • form_set_data($entity, $data)

      This function takes an array data, with the internal_data strings as array access keys, which has instantiated stdClass() objects per field definition (internal_data strings). The attribute "value" stores the value respective to it's internal data string.

      $entity is the ElggEntity that allows metadata, for flexprofile, it's the ElggUser.

    • Looks like form_set_data() and flexprofile_set_data() are exactly the same function.

      Looks like the metadata is being set using create_metadata(), so you can technically get the $user object and just use the regular metadata methods to set and retrieve values.

      For example, if a form field internal_id is "flex_plugin" then $user->flex_plugin = "somevalue"; or echo $user->flex_plugin; would work

       

    • Yep, just confirmed it

      $user->setMetaData(%internal_name%, %value%);
      $user->getMetaData(%internal_name%);

      works fine.

      I think it would be wise, however, to use form_set_data() to control the access. You can always use access_id to override it.

      Hope this helps someone:)

  • Hey all, So I really appreciate this plugin, but I want to know how I can pre-populate fields? I haven't really looked at the code yet, I was thinking someone can save me some time;) If not, I'll post my results here. Thanks in advance, Mahmoud...
    • form_set_data($entity, $data)

      This function takes an array data, with the internal_data strings as array access keys, which has instantiated stdClass() objects per field definition (internal_data strings). The attribute "value" stores the value respective to it's internal data string.

      $entity is the ElggEntity that allows metadata, for flexprofile, it's the ElggUser.

    • Looks like form_set_data() and flexprofile_set_data() are exactly the same function.

      Looks like the metadata is being set using create_metadata(), so you can technically get the $user object and just use the regular metadata methods to set and retrieve values.

      For example, if a form field internal_id is "flex_plugin" then $user->flex_plugin = "somevalue"; or echo $user->flex_plugin; would work

       

    • Yep, just confirmed it

      $user->setMetaData(%internal_name%, %value%);
      $user->getMetaData(%internal_name%);

      works fine.

      I think it would be wise, however, to use form_set_data() to control the access. You can always use access_id to override it.

      Hope this helps someone:)

  • mahmoudimus joined the group Plugin Development
  • mahmoudimus replied on the discussion topic SQL Query from plugin in the group Plugin Development
    First off, I know it's not recommended for a plugin to deal directly with the database. Bear with me. I am writing a plugin that creates clean URLs for pages - for example: myelggsite.com/mypage ...redirects...
    • I agree, I see some extremely great uses for this.

      A typo for Brett's query above:
      $query = "INSERT INTO elggredirection (subdomain, guid) VALUES ('$escapedURL', '$id')";

      Also, I would use insert_data() insert of execute_query()

       

    • Ints don't need to be quoted for MySQL ;)  But it is probably good practice...

      insert_data() is the better function to use!  Good catch on that one.

    • Thanks very much everyone - just to update, execute_query() didn't seem to work at all, whereas insert_data() worked fine, so the code ended up like:

                  // Save the clean URL to the database with the GUID
                  $escapedURL = mysql_real_escape_string($page->cleanurl);
                  $id = mysql_real_escape_string($page->getGUID());
                  $query = "INSERT INTO elggredirection (subdomain, guid) VALUES ('$escapedURL', '$id')";
                  insert_data($query);

      Now I've just got to make sure when a page is deleted the database entry is removed, which should be as simple as using delete_data(). I'll need to tidy it up before I release it as a plugin (currently I'm putting together an extranet using Elgg), so once I'm done with that I'll post it.

  • mahmoudimus replied on the discussion topic Word Filtering - The "Interceptor" in the group General Discussion
    I've started looking into modifying my older KWIC keyword Extracter / Analyzer to be able to better trap spam, bad words, etc. Basically we ourselves have a need to for this for outr own elgg-based web sites. Most word filtering alogirthms,...
    • @Carlos this is why i said something where users are inputing the content, not unlike report content, but modified maybe to gather the offensive phrases and not just individuals who are making a nuisance

    • @Zak... I agree with your approach.. I think it is more SN compatible...

      @all..

      Guys... my friend and I joke all the time... and he sends me a message saying:

      What??? I have to pay???? Fuck you... it aint gonna happen mate.... LMAO

      So, what will interceptor do then???

       

    • oki ;-)

      there are two packages...

      Messages Interceptor (MI)

      Interceptor (I)

      "Interceptor"will be the "word grabber" code I'm trying to make smarter and more intelligent to try and grab obfuscated language where a human can recognize, but coded algorithms based on word lists will miss.

      e.g

      WTF@@K R U wasted OMG that F@@Kin itch jus said f?

      a dictionary word based spam killer may have little hope to trap and block this while everyone know exactly what is being said..

      I hope to make progress with the (algorithm) code and have something smart enough to serve a good purpose in "monitoring" content.

       

Group membership