Expression Engine: member update hook - hook

Is there a hook for when a member's details are updated either by the user or by the admin system?
What i'm trying to do is have two custom fields; long and lat which are populated by using google maps api's geocoding functions.
I need this to be automatic so that when an account is created, a call is made and the long/lat fields are updated and if the user is updated then we check to see if the address data has changed and if it has, re-request the long/lat.
I can find hooks for member create but not for update unless i've not spotted something.
Is there one stashed away somewhere? Or is it possible I can crow-bar one in somehow?
The version of expression engine is 2.2.2

There is no hook for the update_member() method, you are correct. You could look at using the session_start hook, and then checking for $_POST['edit_profile'] within that hook method ... all of the new data should be in $_POST, with $_POST['id'] being the member_id.

Related

Getting a list of BuildFire plugin users from the Widget side

I am developing a plugin that allows the user the post content that I am storing in an object in publicData. To identify the user that posted the data, I am storing the _id that is returned from buildfire.auth.getCurrentUser() in that publicData object along with the content of the post.
Is there a way I can access a list of the users of my plugin, then iterate through that to find the user with the corresponding _id? A list of the users of my plugin must exist somewhere, I just do not know how to/if I can access it.
Any help on this would be greatly appreciated!
I would recommend caching the user object's nonsensitive data. Remember, you have a bit more access to the logged-in user over fetching another user profile using the user id. https://github.com/BuildFire/sdk/wiki/How-to-use-Auth#buildfireauth-getuserprofileoptionscallback
Since the user profile picture URL is really an API, you don't have to worry about the user changing it since it will always return the latest. The other property I recommend you cache is the Display name (not the first name and last name) since that rarely changes as well. This way your performance wont suffer and you can do a lazy fetch for a distinct list of user ids an update them as needed. KNowing most wont need an UI updates since nothing changed

Maximo- Update work order using RESTApi by passing wonum and siteid instead of workorderid

We are currently on Maximo 7.6.1 and have started to use Restful APIs and was wondering if there is a way to update a work order using RESTApi by passing wonum and siteid instead of workorderid.
We would like to avoid one additional GET call for our middleware to retrieve the workorderid and then use it in the PUT request.
Using this URL (OS as well) tries to insert a record even though the HTTP method is PUT.
/maxrest/rest/mbo/WORKORDER?_action=AddChange&siteid=XXX&wonum=7065644&description=Testing
Any pointers will be helpful.
Thanks
The IBM documentation appears to suggest you can only update existing records with the unique ID:
Use the PUT method to update or insert a resource. An update request
must provide the unique ID of the resource. To update an object
structure resource, the ID of the main object is required.
https://www.ibm.com/support/knowledgecenter/en/SSLKT6_7.6.0/com.ibm.mif.doc/gp_intfrmwk/rest_api/r_rest_put_method.html
The response received using the url you provided appears to bear this out in as far as it indicates the work order cannot be created as it already exists:
Error 400: BMXAA4129E - The record for Site=BEDFORD, Work Order=1234
already exists. Ensure that the key value for the given record is
unique.
Reviewing the information at the following url I wasn't able to determine a method to perform the update without the unique ID:
https://www.ibm.com/developerworks/community/wikis/form/anonymous/api/wiki/02db2a84-fc66-4667-b760-54e495526ec1/page/87348f89-b8b4-4c4a-94bd-ecbe1e4e8857/attachment/0a884bde-d17e-471b-b046-7f8feddfd267/media/MaximoNextGenRESTAPI%20%281%29.pdf
In addition the Maximo RESTful API Swagger documentation indicates a POST to /os/mxwo is used to "Create a new resource":
/maximo/oas3/api.html?includeactions=1#/Work_Order_Definition_(MXWO)/post_os_mxwo
Whilst a POST to /os/mxwo/{id} is used to "Update WORKORDER Object":
/maximo/oas3/api.html?includeactions=1#/Work_Order_Definition_(MXWO)/post_os_mxwo__id_
I was however able to update an existing work order using the unique ID. This being the case I can only suggest one of the following:
If you're creating the work order first using the REST/OSLC API,
retrieve and store the unique ID from the response received when the
record is created.
If (1) above is not possible, perform a GET and use parameters in
the query to filter on wonum and siteid and only receive back the minimum of
fields (e.g. workorderid only).
If neither (1) or (2) are feasible investigate whether it's possible
to customise Maximo and create your own endpoint for the work order
object structure that takes wonum and siteid as parameters,
retrieves the mbo and performs the update.

Umbraco uCommerce Secure Trading - need to use OrderNumber instead of OrderGuid

I am trying to use umbraco with uCommerce.
I have implemented SecureTrading as Payment provider in uCommerce. Now I need a solution to use OrderNumber in place of OdrderGuid to be used to identify the PurchaseOrder.
Currently OrderGuid is being sento to SecureTrading & this is being displayed in SecureTrading Transactions section. And due to this identifying the order is really hard.
We have appropriate value in OrderNumber field of PurchaseOrder table & we want to Display that value in SecureTrading's Transaction section.
Any way to achieve this?
If I try to write my own payment provider code, it'll be very huge task, also we have set the SecureTrading environment accordingly to uCommerce default preference.
Immediate help is required.
For more Detail
I have developed a DLL for my own customization as menthioned in http://docs.ucommerce.net/ucommerce/v7.3/payment-providers/integrating-a-payment-gateway.html But, that also is not working. the custom Payment Provider added in code(DLL) is not visible in backoffice to change the Payment Provider. There are all old entries for providers.
Even nothing shows up in cms Admin section for uCommerce Settings.
Thanks
Hi you can create a derrived version of the PageBuilder which will send the parameters to SecureTrading.
There's a protected virtual method you can override called "GetParameters".
It returns a dictionary that holds everything that will be send to SecureTrading.
You can set the "orderreference" in the dictionary to OrderNumber. This originally holds the orderguid.
Don't forget to register your page builder in the IoC container.
http://docs.ucommerce.net/ucommerce/v7.5/extending-ucommerce/register-a-component.html
You need to override the component by reusing the ID that the page builder has, which is: "SecureTradingPageBuilder". When overriding the page builder you don't have to change anything in the back office.
This should fix your problem :)

In CRM 2011, best way to send information from javascript to plugins

I have an HTML web resource on a CRM 2011 form that users will be entering data into. This data will be required by CRM create/update plugins if the user chooses to save the main form, but there is no functional requirement that the data needs to be saved to any field on the entity. I am considering a hidden dummy field that the data could be saved to, but am wondering if there is anything more elegant for persisting data from the client to server technologies. I've done some research on "sharedvariables" but haven't been able to determine if they might meet this need. Any example of setting a value using JavaScript and then retrieving it from a plugin would be valuable.
Edit: I just wanted to clarify the response that I received based on my testing. While CRM has "SharedVariables" available for both plugin and scripting use, any data saved in scripts will not be available to plugins. Data saved by one javascript function to "SharedVariables" will be available to other javascript functions registered for the same event, and data saved by a plugin is available to other plugins registered for the same event, but the data is not persisted from script to plugins or vise-versa. This leaves dummy fields as the only option for persisting data from javascript to plugins. As NickNow suggested, unless you need to persist the data to a database, deleting it on a pre-plugin would be a good idea. Thanks Nicknow!
The hidden/dummy field is the correct approach. SharedVariables don't exist, from the standpoint of a plugin, until the data is sent to the server.
The form save is just a UI to trigger the Create or Update event - from the platform's standpoint you are just sending an entity logical name, the record guid (for an update), and the fields/values. The plugin has no knowledge, and shouldn't require knowledge, of how the event was triggered.
What I do is create a field (such as `new_internalmessaging') as a text field (since I'll never persist the value to the database I just make it a 2000 character string). During a JavaScript OnSave event I grab whatever data I need into an object and create a JSON string which I then use to populate the field.
In my Pre-Create and Pre-Update plugins I retrieve the string and deserialize it to an object for use in my plugin (I can also place it into a SharedVariable at this point if I need it for a post plugin). At this point the plugin code should remove new_internalmessaging from the Target.
I do this to ensure the data in that field will never get persisted to CRM.

Data in custom attribute not returned in UserProfile object in MOSS

I've created two new custom attributes in the UserProfile. When the service we wrote returns data about a specific user by using the UserProfile object, sometimes the data isn't returned, even though if we look at the user in SSP it look populated. Some users work; this is the first user we set up with data. I'm not sure if sometime in the meantime after setting up the first user and testing, if there's something we ran and need to run again. How can I get all the users to get their data returned in a call to their UserProfile?
It may be a language issue, perhaps you can detect a pattern in working/not working users and their language?
Have you looked at the visibility of the custom attributes? Is it possible that it's a question of who is supposed to be able see the attribute that is causing your issue?
It could be connected to when the profile was created and when the attributes were added.
Is there any pattern to which users work and which do not?
Try creating a new user, and see if the attributes are available for that user.

Resources