I want to upload course using upload courses menu.
and i want to import the id with the other fields.
I tried "id","shortname","fullname","category" as a filed on the csv.But it uses incremented id instead.
Oh and i want the same thing for user too.
That cannot be done - all ids in Moodle are automatically generated, in order to make sure they always uniquely identify the item (course, user, etc).
Instead of trying to identify the course by id, you should look at identifying it by shortname or idnumber.
Related
I'm currently making a store which is receiving it's data from external sources. Being new to the world of editing/creating REST API, I've come across a problem. The problem is that the external source have no idea what ID the product gets in woocommerce so update/delete products is not possible with the current endpoints/routes. However, the external source does have it's own ID on it's product and I've stored this in a custom meta field in woo and I can see it and update it through api on Postman.
How can i create a new endpoint/route that uses the custom meta field called externalProductId and use this to update the product instead of the woocommerce ID?
What you can do, which I particularly did in my case ... Create a field id_product_woo in your external bank, the time you create the product in Woocommerce, it returns a JSON with the information of the product created, including the ID inside Woocommerce... When you create or update a product in Woocommerce, you then pass the id stored in the id_product_woo field of your external bank.
Apparently, this for me, worked perfectly.
I've got an issue with a button.
I've got clients, and these all have a number ( Clients:: ClientID). Now I want to make a button in another form and send the active clientID to another application which will use this clientID to display information in that application about that client.
Now I've made a button with the open URL which contains following code snippet:
"http://localhost:12345/showClientFile?clientid=" & Clients::ClientID
When I click the button in viewlayout, the application always (no matter which record I'm in) the same clientID and not the clientID from the record that I'm in. When I check the URL in the browser, it is also that same id constantly. Am I missing something?
If you're on a layout that isn't linked to the Clients table occurrence, then there must be a relationship from whichever TO your layout is linked to to the Clients table. Otherwise you wouldn't see any value for Clients::ClientID.
You say you want to send the "active clientID". How do you, or the system, know what the active clientID is? Is it stored in a global variable, as in $$_ACTIVE_CLIENT_ID, or perhaps a global field, Clients::g_active_client_id? When you can say to yourself, "When I want to know what the active client ID is, I look here," then you know what will need to be done to edit the URL calculation.
"http://localhost:12345/showClientFile?clientid=" & $$_ACTIVE_CLIENT_ID
I rewrote the title and content 3 times before posting it, I don't find the right way to ask this :P
I have a page that manage a list of notes, I have a CRUD on that page but the items are created and saved in javascript (using knockoutjs).
I create a new note, I add it to the model in javascript and it show up in the page.
The way Im saving the notes to the database is when I add it to the model, I send it via Ajax (async) to the server. So I have my note on screen and in the database really fast.
I send a note without Id to the server and EF will take care of the Id.
So far so good.
Imagine that I add a note but I dont refresh the webpage, so the note is in the database, is in the javascript model too but in the model it doesn't have the id yet.
I make some changes to the note and yeah, I want to update the note in the database... but... how?
I send my note to the server with the changes, but remember, the item still have no Id so I can't say:
Hey EF, give me the note with the ID == xx and we are going to update that note.
The others properties can be changed on the webpage so I have nothing that identifies the note apart from the Id, who doesn't work here.
I tried this:
Send the new note to the server, insert it on the database, retrieve it again (to pick the Id), send it back to javascript and update the object with the Id. So when I edit, I have the Id. Yeah, but the "save" call need to be sync and that destroy the experience.
Any ideas?
EDIT: The sync options is not that slow at the end but there have to be a async way and meh, the thing of "Insert on database", "Retrieve the last item I inserted" and "return back to the client" is a little hackish.
You could return the id of the new record in your asynch call. If you are using jQuery you can subscribe to the "success" callback and as long as your controller returns a JSON with the id of the new record you could update your model on the client side.
Even with this approach, you will need to have a way to identify the item updated on the client side (which is really the root of your question.) For that you can probably generate a random GUID on the client side, send it to the server when saving, and return it to jQuery when returning the ID so that you can identify the correct element to update on the page.
Whats up.
I'm looking for some information about linking a vBulletin user database with my actual website's database. I do already have a users table, users have their main website profiles and all, but I would also like them to be able to use the same account on the forum (forum not up yet)
So is it fairly simple to do that? I'm simply asking because I have no clue, and don't know where to start!
Any help would be really appreciated!
unless you want to do some serious editing to the vbulletin code i suggest using vbulletin's user table for everything. if you did the main site yourself it should be alot easier for you to edit it then to edit vb.
just connect to the database like normal. then use mysql to check their username/password like so:
SELECT * FROM `usertable` WHERE `username` = '$username' AND `password` = MD5(CONCAT(MD5('$password'),salt)) LIMIT 1
if you need to include extra data for your main site be careful just adding rows to the user table as vbulletin doesnt like that. few ways around it
make a vb plugin to the "userdata_start" hook with this code:
$this->validfields['custom_usertable_row'] = array(TYPE_INT, REQ_YES);
change TYPE_INT if your not saving an integer. and REQ_YES if the row can be null.
add custom user profile fields. from the admincp User Profile Fields>Add User Profile Field
it will add the field to a different table called userfield which you can get by joining the tables in a query
SELECT user.username, userfield.field1 FROM user LEFT JOIN userfield ON user.userid=userfield.userid
make your own table and join like above.
I am building a small facebook application, in which I am performing the following:
The user fills out his friend's names (using friend selector), What I want to do next is retrieve the friend's user ID based on their user name. Is it possible? Can I query a user by its name and receive his id?
That's not true! usernames ARE unique too, but the actual name isn't unique!
The username itself is the part from the url e.g.: www.facebook.com/zuck (Page from Mark Zuckerberg) his username is zuck BUT not all user have set a username. For them it shows an userid e.g.: www.facebook.com/profile.php?id=123
No because names aren't unique. What you could do though is capture the UIDs that the friend is submitting, because even though it looks like names, what he's really doing is picking out UID's. Then, even without your app being approved, you can query some basic data (first, last, locale, profile url)